Commit cfbd96121eead28499eb78603500b35dfcd8d0fd
Exists in
staging
and in
1 other branch
Merge branch 'master' into staging
Showing
3 changed files
with
36 additions
and
2 deletions
Show diff stats
app/helpers/article_helper.rb
| ... | ... | @@ -188,9 +188,9 @@ module ArticleHelper |
| 188 | 188 | def following_button(page, user) |
| 189 | 189 | if !user.blank? and user != page.author |
| 190 | 190 | if page.is_followed_by? user |
| 191 | - button :cancel, unfollow_button_text(page), {:controller => 'profile', :action => 'unfollow_article', :article_id => page.id} | |
| 191 | + button :cancel, unfollow_button_text(page), {:controller => 'profile', :action => 'unfollow_article', :article_id => page.id, :profile => page.profile.identifier} | |
| 192 | 192 | else |
| 193 | - button :add, follow_button_text(page), {:controller => 'profile', :action => 'follow_article', :article_id => page.id} | |
| 193 | + button :add, follow_button_text(page), {:controller => 'profile', :action => 'follow_article', :article_id => page.id, :profile => page.profile.identifier} | |
| 194 | 194 | end |
| 195 | 195 | end |
| 196 | 196 | end | ... | ... |
test/functional/content_viewer_controller_test.rb
| ... | ... | @@ -1644,4 +1644,22 @@ class ContentViewerControllerTest < ActionController::TestCase |
| 1644 | 1644 | assert_select '.article-body-img > img', 0 |
| 1645 | 1645 | end |
| 1646 | 1646 | |
| 1647 | + should 'render follow article button in another domain' do | |
| 1648 | + d = Domain.new | |
| 1649 | + d.name = "theresourcebasedeconomy.com" | |
| 1650 | + d.save! | |
| 1651 | + profile = fast_create(Community) | |
| 1652 | + profile.domains << d | |
| 1653 | + | |
| 1654 | + page = profile.articles.build(:name => 'myarticle', :body => 'the body of the text') | |
| 1655 | + page.save! | |
| 1656 | + | |
| 1657 | + login_as(create_user.login) | |
| 1658 | + ActionController::TestRequest.any_instance.expects(:host).returns('theresourcebasedeconomy.com').at_least_once | |
| 1659 | + get :view_page, :page => 'myarticle' | |
| 1660 | + | |
| 1661 | + assert_equal profile, assigns(:profile) | |
| 1662 | + assert_tag tag: 'a', attributes: {'title' => 'Follow'} | |
| 1663 | + end | |
| 1664 | + | |
| 1647 | 1665 | end | ... | ... |
| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | +require 'test_helper' | |
| 2 | + | |
| 3 | +class ArticleHelperTest < ActionView::TestCase | |
| 4 | + include ArticleHelper | |
| 5 | + include ButtonsHelper | |
| 6 | + | |
| 7 | + should 'render follow article button' do | |
| 8 | + environment = Environment.default | |
| 9 | + person = fast_create(Person) | |
| 10 | + profile = fast_create(Profile, :environment_id => environment) | |
| 11 | + article = fast_create(Article, :profile_id => profile) | |
| 12 | + link = following_button article, person | |
| 13 | + assert_tag_in_string link, tag: 'a', attributes: {'title' => 'Follow'} | |
| 14 | + end | |
| 15 | + | |
| 16 | +end | ... | ... |