FIX: Response is no longer forbidden with JSON errors for changing trust

level.
This commit is contained in:
Robin Ward 2014-07-29 16:10:04 -04:00
parent 6844edc564
commit 2096861d79

View File

@ -171,12 +171,12 @@ describe Admin::UsersController do
it "raises an error when the user doesn't have permission" do
Guardian.any_instance.expects(:can_change_trust_level?).with(@another_user).returns(false)
xhr :put, :trust_level, user_id: @another_user.id
response.should be_forbidden
response.should_not be_success
end
it "returns a 404 if the username doesn't exist" do
xhr :put, :trust_level, user_id: 123123
response.should be_forbidden
response.should_not be_success
end
it "upgrades the user's trust level" do
@ -184,6 +184,7 @@ describe Admin::UsersController do
xhr :put, :trust_level, user_id: @another_user.id, level: 2
@another_user.reload
@another_user.trust_level.should == 2
response.should be_success
end
it "raises an error when demoting a user below their current trust level" do
@ -195,7 +196,7 @@ describe Admin::UsersController do
stat.save!
@another_user.update_attributes(trust_level: TrustLevel.levels[:basic])
xhr :put, :trust_level, user_id: @another_user.id, level: TrustLevel.levels[:newuser]
response.should be_forbidden
response.should_not be_success
end
end