From 78bd24c6f738ea946622bfab5b6ea8a2040f5bde Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 5 Feb 2012 16:35:27 +0000 Subject: Resourcified project memberships. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8789 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/members_controller_test.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'test/functional/members_controller_test.rb') diff --git a/test/functional/members_controller_test.rb b/test/functional/members_controller_test.rb index 3a4b2256c..ffea36e2b 100644 --- a/test/functional/members_controller_test.rb +++ b/test/functional/members_controller_test.rb @@ -35,7 +35,7 @@ class MembersControllerTest < ActionController::TestCase def test_create assert_difference 'Member.count' do - post :new, :id => 1, :member => {:role_ids => [1], :user_id => 7} + post :create, :project_id => 1, :membership => {:role_ids => [1], :user_id => 7} end assert_redirected_to '/projects/ecookbook/settings/members' assert User.find(7).member_of?(Project.find(1)) @@ -43,7 +43,7 @@ class MembersControllerTest < ActionController::TestCase def test_create_multiple assert_difference 'Member.count', 3 do - post :new, :id => 1, :member => {:role_ids => [1], :user_ids => [7, 8, 9]} + post :create, :project_id => 1, :membership => {:role_ids => [1], :user_ids => [7, 8, 9]} end assert_redirected_to '/projects/ecookbook/settings/members' assert User.find(7).member_of?(Project.find(1)) @@ -51,7 +51,7 @@ class MembersControllerTest < ActionController::TestCase def test_xhr_create assert_difference 'Member.count', 3 do - post :new, :format => "js", :id => 1, :member => {:role_ids => [1], :user_ids => [7, 8, 9]} + post :create, :project_id => 1, :membership => {:role_ids => [1], :user_ids => [7, 8, 9]}, :format => "js" end assert_select_rjs :replace_html, 'tab-content-members' assert User.find(7).member_of?(Project.find(1)) @@ -61,7 +61,7 @@ class MembersControllerTest < ActionController::TestCase def test_xhr_create_with_failure assert_no_difference 'Member.count' do - post :new, :format => "js", :id => 1, :member => {:role_ids => [], :user_ids => [7, 8, 9]} + post :create, :project_id => 1, :membership => {:role_ids => [], :user_ids => [7, 8, 9]}, :format => "js" end assert_select '#tab-content-members', 0 assert @response.body.match(/alert/i), "Alert message not sent" @@ -69,14 +69,14 @@ class MembersControllerTest < ActionController::TestCase def test_edit assert_no_difference 'Member.count' do - post :edit, :id => 2, :member => {:role_ids => [1], :user_id => 3} + put :update, :id => 2, :membership => {:role_ids => [1], :user_id => 3} end assert_redirected_to '/projects/ecookbook/settings/members' end def test_xhr_edit assert_no_difference 'Member.count' do - xhr :post, :edit, :id => 2, :member => {:role_ids => [1], :user_id => 3} + xhr :put, :update, :id => 2, :membership => {:role_ids => [1], :user_id => 3} end assert_select_rjs :replace_html, 'tab-content-members' member = Member.find(2) @@ -86,7 +86,7 @@ class MembersControllerTest < ActionController::TestCase def test_destroy assert_difference 'Member.count', -1 do - post :destroy, :id => 2 + delete :destroy, :id => 2 end assert_redirected_to '/projects/ecookbook/settings/members' assert !User.find(3).member_of?(Project.find(1)) @@ -94,17 +94,17 @@ class MembersControllerTest < ActionController::TestCase def test_xhr_destroy assert_difference 'Member.count', -1 do - xhr :post, :destroy, :id => 2 + xhr :delete, :destroy, :id => 2 end assert_select_rjs :replace_html, 'tab-content-members' end - def test_autocomplete_for_member - get :autocomplete_for_member, :id => 1, :q => 'mis' + def test_autocomplete + get :autocomplete, :project_id => 1, :q => 'mis' assert_response :success - assert_template 'autocomplete_for_member' + assert_template 'autocomplete' assert_tag :label, :content => /User Misc/, - :child => { :tag => 'input', :attributes => { :name => 'member[user_ids][]', :value => '8' } } + :child => { :tag => 'input', :attributes => { :name => 'membership[user_ids][]', :value => '8' } } end end -- cgit v1.2.3