Test title updating
This commit is contained in:
parent
3cc17ad4cd
commit
c0cffca1e6
|
@ -875,7 +875,7 @@ describe UsersController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'without permission to update' do
|
context 'without permission to update any attributes' do
|
||||||
it 'does not allow the update' do
|
it 'does not allow the update' do
|
||||||
user = Fabricate(:user, name: 'Billy Bob')
|
user = Fabricate(:user, name: 'Billy Bob')
|
||||||
log_in_user(user)
|
log_in_user(user)
|
||||||
|
@ -889,6 +889,20 @@ describe UsersController do
|
||||||
expect(user.reload.name).not_to eq 'Jim Tom'
|
expect(user.reload.name).not_to eq 'Jim Tom'
|
||||||
end
|
end
|
||||||
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue