Removes RJS from GroupsController.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10044 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-07-19 16:57:59 +00:00
parent 035805fbd0
commit 21ee2e2cf2
6 changed files with 46 additions and 30 deletions
+27 -5
View File
@@ -113,8 +113,11 @@ class GroupsControllerTest < ActionController::TestCase
def test_xhr_add_users
assert_difference 'Group.find(10).users.count', 2 do
xhr :post, :add_users, :id => 10, :user_ids => ['2', '3']
assert_response :success
assert_template 'add_users'
assert_equal 'text/javascript', response.content_type
end
assert_select_rjs :replace_html, 'tab-content-users'
assert_match /John Smith/, response.body
end
def test_remove_user
@@ -126,8 +129,10 @@ class GroupsControllerTest < ActionController::TestCase
def test_xhr_remove_user
assert_difference 'Group.find(10).users.count', -1 do
xhr :delete, :remove_user, :id => 10, :user_id => '8'
assert_response :success
assert_template 'remove_user'
assert_equal 'text/javascript', response.content_type
end
assert_select_rjs :replace_html, 'tab-content-users'
end
def test_new_membership
@@ -139,15 +144,21 @@ class GroupsControllerTest < ActionController::TestCase
def test_xhr_new_membership
assert_difference 'Group.find(10).members.count' do
xhr :post, :edit_membership, :id => 10, :membership => { :project_id => 2, :role_ids => ['1', '2']}
assert_response :success
assert_template 'edit_membership'
assert_equal 'text/javascript', response.content_type
end
assert_select_rjs :replace_html, 'tab-content-memberships'
assert_match /OnlineStore/, response.body
end
def test_xhr_new_membership_with_failure
assert_no_difference 'Group.find(10).members.count' do
xhr :post, :edit_membership, :id => 10, :membership => { :project_id => 999, :role_ids => ['1', '2']}
assert_response :success
assert_template 'edit_membership'
assert_equal 'text/javascript', response.content_type
end
assert @response.body.match(/alert/i), "Alert message not sent"
assert_match /alert/, response.body, "Alert message not sent"
end
def test_edit_membership
@@ -156,6 +167,15 @@ class GroupsControllerTest < ActionController::TestCase
end
end
def test_xhr_edit_membership
assert_no_difference 'Group.find(10).members.count' do
xhr :post, :edit_membership, :id => 10, :membership_id => 6, :membership => { :role_ids => ['1', '3']}
assert_response :success
assert_template 'edit_membership'
assert_equal 'text/javascript', response.content_type
end
end
def test_destroy_membership
assert_difference 'Group.find(10).members.count', -1 do
post :destroy_membership, :id => 10, :membership_id => 6
@@ -165,8 +185,10 @@ class GroupsControllerTest < ActionController::TestCase
def test_xhr_destroy_membership
assert_difference 'Group.find(10).members.count', -1 do
xhr :post, :destroy_membership, :id => 10, :membership_id => 6
assert_response :success
assert_template 'destroy_membership'
assert_equal 'text/javascript', response.content_type
end
assert_select_rjs :replace_html, 'tab-content-memberships'
end
def test_autocomplete_for_user