From b146eb60a4a51faf0834400dd07534493da0e16e Mon Sep 17 00:00:00 2001 From: JoenioCosta Date: Fri, 28 Mar 2008 13:10:06 +0000 Subject: [PATCH] ActionItem226: not show 'Join this community' to members --- app/views/blocks/profile_info_actions/community.rhtml | 2 +- test/functional/profile_controller_test.rb | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/views/blocks/profile_info_actions/community.rhtml b/app/views/blocks/profile_info_actions/community.rhtml index 7ee47e4..3343e8a 100644 --- a/app/views/blocks/profile_info_actions/community.rhtml +++ b/app/views/blocks/profile_info_actions/community.rhtml @@ -1,5 +1,5 @@ diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index 18253d2..eba61b7 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -46,4 +46,26 @@ class ProfileControllerTest < Test::Unit::TestCase assert_template 'members' assert_kind_of Array, assigns(:members) end + + should 'show Join This Community button for non-member users' do + login_as(@profile.identifier) + community = Community.create!(:name => 'my test community') + get :index, :profile => community.identifier + assert_tag :tag => 'a', :content => 'Join this community' + end + + should 'not show Join This Community button for member users' do + login_as(@profile.identifier) + community = Community.create!(:name => 'my test community') + community.add_member(@profile) + get :index, :profile => community.identifier + assert_no_tag :tag => 'a', :content => 'Join this community' + end + + should 'not show Join This Community button for non-registered users' do + community = Community.create!(:name => 'my test community') + get :index, :profile => community.identifier + assert_no_tag :tag => 'a', :content => 'Join this community' + end + end -- libgit2 0.21.2