From 79d7401c7c9fd97dd7b096591f6de95554b26d7f Mon Sep 17 00:00:00 2001 From: JoenioCosta Date: Wed, 7 May 2008 19:34:16 +0000 Subject: [PATCH] ActionItem384: added button 'Leave from community' --- app/views/blocks/profile_info_actions/community.rhtml | 8 ++++++-- test/functional/profile_controller_test.rb | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/app/views/blocks/profile_info_actions/community.rhtml b/app/views/blocks/profile_info_actions/community.rhtml index 3343e8a..0b28cfa 100644 --- a/app/views/blocks/profile_info_actions/community.rhtml +++ b/app/views/blocks/profile_info_actions/community.rhtml @@ -1,5 +1,9 @@ diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index 4723a4b..7a58269 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -158,4 +158,25 @@ class ProfileControllerTest < Test::Unit::TestCase assert_no_tag :tag => 'a', :child => { :tag => 'span', :content => 'Create a new community' } end + should 'not show Leave 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_no_tag :tag => 'a', :content => 'Leave this community' + end + + should 'show Leave 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_tag :tag => 'a', :content => 'Leave this community' + end + + should 'not show Leave 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 => 'Leave this community' + end + end -- libgit2 0.21.2