summaryrefslogtreecommitdiff
path: root/users/test/functional
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-12-03 10:52:01 +0100
committerAzul <azul@leap.se>2012-12-03 10:52:01 +0100
commit2a928455f9dcefa465b80b79768ba1d1a423e6e9 (patch)
tree9a169d415a7f7eb80c28b6e313613b4a4a10f44b /users/test/functional
parent1de597b338f0622a7732676907365de673c34dfb (diff)
enable users to cancel their account
Diffstat (limited to 'users/test/functional')
-rw-r--r--users/test/functional/users_controller_test.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/users/test/functional/users_controller_test.rb b/users/test/functional/users_controller_test.rb
index f008cda..44b6768 100644
--- a/users/test/functional/users_controller_test.rb
+++ b/users/test/functional/users_controller_test.rb
@@ -63,10 +63,19 @@ class UsersControllerTest < ActionController::TestCase
login :is_admin? => true
user = stub_record User
user.expects(:destroy)
- User.expects(:find_by_param).with(user.id.to_s).returns(user)
+ User.expects(:find_by_param).with(user.id).returns(user)
delete :destroy, :id => user.id
assert_response :redirect
- # assert_redirected_to users_path
+ assert_redirected_to users_path
+ end
+
+ test "user can cancel account" do
+ login
+ @current_user.expects(:destroy)
+ User.expects(:find_by_param).with(@current_user.id).returns(@current_user)
+ delete :destroy, :id => @current_user.id
+ assert_response :redirect
+ assert_redirected_to login_path
end
test "non-admin can't destroy user" do