diff options
Diffstat (limited to 'users')
-rw-r--r-- | users/app/views/users/_user.html.haml | 3 | ||||
-rw-r--r-- | users/test/functional/users_controller_test.rb | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/users/app/views/users/_user.html.haml b/users/app/views/users/_user.html.haml index 5eb7941..7db0041 100644 --- a/users/app/views/users/_user.html.haml +++ b/users/app/views/users/_user.html.haml @@ -2,6 +2,9 @@ %td= user.login %td= time_ago_in_words(user.created_at) + " ago" %td + = link_to edit_user_path(user), :class => "btn btn-mini btn-primary" do + %i.icon-edit.icon-white + Edit = link_to user_path(user), :method => :delete, :class => "btn btn-danger btn-mini" do %i.icon-remove.icon-white Remove 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 |