... 40 41 42 43 44 45 46 ... 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 ... 138 139 140 141 142 143 144 145 146 147 |
... 40 41 42 43 44 45 46 ... 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 ... 138 139 140 141 142 143 144 145 146 147 |
0 @@ -40,7 +40,7 @@ class Admin::UsersControllerTest < Test::Unit::TestCase 0 assert_difference User, :count do 0 assert_difference Membership, :count do 0 - post :create, :user => { :login => 'bob', :email => 'foo@example.com', :password => 'testy', :password_confirmation => 'testy' , :admin => true } 0 + post :create, :user => { :login => 'bob', :email => 'foo@example.com', :password => 'testy', :password_confirmation => 'testy' } 0 assert_models_equal [sites(:first)], assigns(:user).sites 0 assert_equal assigns(:user), User.authenticate_for(sites(:first), 'bob', 'testy') 0 assert_redirected_to :action => 'index' 0 @@ -117,19 +117,19 @@ class Admin::UsersControllerTest < Test::Unit::TestCase 0 def test_should_not_permit_promoting_self_to_admin_in_update 0 login_as :arthur, :hostess 0 assert !users(:arthur).admin, "we mean to test with a non-admin user" 0 - post :update, :id => users(:arthur).id, :user => { :admin => 'true' } 0 + assert_raises(ActiveRecord::ProtectedAttributeAssignmentError) { post :update, :id => users(:arthur).id, :user => { :admin => 'true' } } 0 assert !users(:arthur).admin, "user.admin shouldn't change" 0 - assert_response :success0 def test_should_not_permit_changing_own_created_at_in_update 0 login_as :arthur, :hostess 0 prev_time = users(:arthur).created_at 0 - post :update, :id => users(:arthur).id, :user => { :created_at => prev_time - 1.year } 0 + assert_raises(ActiveRecord::ProtectedAttributeAssignmentError) { post :update, :id => users(:arthur).id, :user => { :created_at => prev_time - 1.year } } 0 assert_equal prev_time, users(:arthur).created_at, "user.created_at shouldn't change" 0 - assert_response :success0 def test_should_not_permit_changing_owned_articles_in_update 0 @@ -138,10 +138,10 @@ class Admin::UsersControllerTest < Test::Unit::TestCase 0 prev_article_ids = user.article_ids 0 assert prev_article_ids.size > 2, "Test needs more than 2 articles. Pick another user?" 0 #but now we're going to try to own only the first 2 of them... 0 - post :update, :id => user.id, :user => { :article_ids => prev_article_ids[0..1] } 0 + assert_raises(ActiveRecord::ProtectedAttributeAssignmentError) { post :update, :id => user.id, :user => { :article_ids => prev_article_ids[0..1] }} 0 assert_equal prev_article_ids, user.article_ids, "user.article_ids[] shouldn't change" 0 - assert_response :success0 def test_should_show_deleted_users
|
Comments
No one has commented yet.