From 6df5b38b54d265fef0e6a9749ff89839db898374 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Wed, 24 Feb 2016 16:09:39 +0530 Subject: [PATCH] better user update spec --- spec/controllers/users_controller_spec.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 20cd1de56c2..eb83ce115f5 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -1229,10 +1229,7 @@ describe UsersController do it 'does not allow the update' do user = Fabricate(:user, name: 'Billy Bob') log_in_user(user) - guardian = Guardian.new(user) - guardian.stubs(:ensure_can_edit!).with(user).raises(Discourse::InvalidAccess.new) - Guardian.stubs(new: guardian).with(user) - Guardian.stubs(new: guardian).with(nil) + Guardian.any_instance.expects(:can_edit?).with(user).returns(false) put :update, username: user.username, name: 'Jim Tom'