Permalink
Browse files

fit test for user with password comfirmation

  • Loading branch information...
1 parent d7ed71a commit 566f0a96a4e7350814693381f16cb784849e8453 @FuriKuri committed Nov 6, 2012
Showing with 10 additions and 4 deletions.
  1. +10 −4 test/functional/users_controller_test.rb
View
14 test/functional/users_controller_test.rb
@@ -2,6 +2,12 @@
class UsersControllerTest < ActionController::TestCase
setup do
+ @input_attributes = {
+ name: "sam",
+ password: "private",
+ password_confirmation: "private"
+ }
+
@user = users(:one)
end
@@ -18,10 +24,10 @@ class UsersControllerTest < ActionController::TestCase
test "should create user" do
assert_difference('User.count') do
- post :create, user: { name: @user.name, password_digest: @user.password_digest }
+ post :create, user: @input_attributes
end
- assert_redirected_to user_path(assigns(:user))
+ assert_redirected_to users_path
end
test "should show user" do
@@ -35,8 +41,8 @@ class UsersControllerTest < ActionController::TestCase
end
test "should update user" do
- put :update, id: @user, user: { name: @user.name, password_digest: @user.password_digest }
- assert_redirected_to user_path(assigns(:user))
+ put :update, id: @user.to_param, user: @input_attributes
+ assert_redirected_to users_path
end
test "should destroy user" do

0 comments on commit 566f0a9

Please sign in to comment.