Test title updating

This commit is contained in:
Scott Albertson 2013-11-01 13:27:48 -07:00
parent 3cc17ad4cd
commit c0cffca1e6
1 changed files with 15 additions and 1 deletions

View File

@ -875,7 +875,7 @@ describe UsersController do
end
end
context 'without permission to update' do
context 'without permission to update any attributes' do
it 'does not allow the update' do
user = Fabricate(:user, name: 'Billy Bob')
log_in_user(user)
@ -889,6 +889,20 @@ describe UsersController do
expect(user.reload.name).not_to eq 'Jim Tom'
end
end
context 'without permission to update title' do
it 'does not allow the user to update their title' do
user = Fabricate(:user, title: 'Emperor')
log_in_user(user)
guardian = Guardian.new(user)
guardian.stubs(can_grant_title?: false).with(user)
Guardian.stubs(new: guardian).with(user)
put :update, username: user.username, title: 'Minion'
expect(user.reload.title).not_to eq 'Minion'
end
end
end
end