summaryrefslogtreecommitdiff
path: root/users/test
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-11-23 10:24:46 +0100
committerAzul <azul@leap.se>2012-11-23 10:24:46 +0100
commit3ce5a25afef3b938c2bbbe8ce481f2af9e0c24dc (patch)
tree20b7c35ebed3836cab7bbc7864d1d077b63f0e9c /users/test
parent33c124aa67788d5c64906f7b3e21ad383577b2a8 (diff)
test editing user settings
Diffstat (limited to 'users/test')
-rw-r--r--users/test/functional/users_controller_test.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/users/test/functional/users_controller_test.rb b/users/test/functional/users_controller_test.rb
index 1cb28a6..feae2dd 100644
--- a/users/test/functional/users_controller_test.rb
+++ b/users/test/functional/users_controller_test.rb
@@ -30,4 +30,35 @@ class UsersControllerTest < ActionController::TestCase
assert_redirected_to new_user_path
end
+ test "should get edit view" do
+ params = User.valid_attributes_hash
+ user = stub params.merge(:id => 123, :class => User, :to_key => ['123'], :new_record? => false, :persisted? => :true)
+ login user
+ get :edit, :id => user.id
+ assert_equal user, assigns[:user]
+ end
+
+ test "should process updated params" do
+ params = User.valid_attributes_hash
+ user = stub params.merge(:id => 123)
+ params.stringify_keys!
+ user.expects(:update).with(params).returns(user)
+ login user
+ post :update, :user => params, :id => user.id
+ assert_equal user, assigns[:user]
+ assert_response :redirect
+ assert_redirected_to edit_user_path(user)
+ end
+
+ test "should validate updated params" do
+ params = User.valid_attributes_hash
+ user = stub params.merge(:id => 123)
+ params.stringify_keys!
+ user.expects(:update).with(params).returns(user)
+ login user
+ post :update, :user => params, :id => user.id
+ assert_equal user, assigns[:user]
+ end
+
+
end