diff options
Diffstat (limited to 'users/test')
-rw-r--r-- | users/test/functional/users_controller_test.rb | 31 |
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 |