summaryrefslogtreecommitdiff
path: root/users/test/functional/users_controller_test.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-12-03 10:24:49 +0100
committerAzul <azul@leap.se>2012-12-03 10:31:32 +0100
commit1de597b338f0622a7732676907365de673c34dfb (patch)
tree5eed63767fff4d7d9760029a748bcf1529815781 /users/test/functional/users_controller_test.rb
parent0b23df922336289b6f8062653b4d3e852ed927ec (diff)
enable admin to edit users
Diffstat (limited to 'users/test/functional/users_controller_test.rb')
-rw-r--r--users/test/functional/users_controller_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/users/test/functional/users_controller_test.rb b/users/test/functional/users_controller_test.rb
index ab29845..f008cda 100644
--- a/users/test/functional/users_controller_test.rb
+++ b/users/test/functional/users_controller_test.rb
@@ -44,8 +44,19 @@ class UsersControllerTest < ActionController::TestCase
login user
put :update, :user => user.params, :id => user.id, :format => :json
assert_equal user, assigns[:user]
+ assert_response 204
assert_equal " ", @response.body
+ end
+
+ test "admin can edit user" do
+ user = stub_record User
+ user.expects(:update_attributes).with(user.params).returns(true)
+ User.expects(:find_by_param).with(user.id.to_s).returns(user)
+ login :is_admin? => true
+ put :update, :user => user.params, :id => user.id, :format => :json
+ assert_equal user, assigns[:user]
assert_response 204
+ assert_equal " ", @response.body
end
test "admin can destroy user" do