Update fixtures
This commit is contained in:
parent
b48e6919fa
commit
1cfaea1eb3
|
@ -1,8 +1,8 @@
|
||||||
---
|
---
|
||||||
user:
|
erik:
|
||||||
name: User
|
name: Erik Michaels-Ober
|
||||||
organization: Code for America
|
organization: Code for America
|
||||||
email: user@example.com
|
email: erik@example.com
|
||||||
voice_number: 1234567890
|
voice_number: 1234567890
|
||||||
sms_number: 1234567890
|
sms_number: 1234567890
|
||||||
encrypted_password: "$2a$10$KF/JMZ494ZLhWLgHZeBTf.cSL4l0Wjij4gIZP7BzkueAC1p4nW0ma"
|
encrypted_password: "$2a$10$KF/JMZ494ZLhWLgHZeBTf.cSL4l0Wjij4gIZP7BzkueAC1p4nW0ma"
|
||||||
|
|
|
@ -4,7 +4,7 @@ class SessionsControllerTest < ActionController::TestCase
|
||||||
include Devise::TestHelpers
|
include Devise::TestHelpers
|
||||||
setup do
|
setup do
|
||||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
@user = users(:user)
|
@user = users(:erik)
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'should render combo form' do
|
test 'should render combo form' do
|
||||||
|
|
|
@ -4,7 +4,7 @@ class UsersControllerTest < ActionController::TestCase
|
||||||
include Devise::TestHelpers
|
include Devise::TestHelpers
|
||||||
setup do
|
setup do
|
||||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
@user = users(:user)
|
@user = users(:erik)
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'should render info window' do
|
test 'should render info window' do
|
||||||
|
@ -35,27 +35,27 @@ class UsersControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
test 'should update user if password is correct' do
|
test 'should update user if password is correct' do
|
||||||
sign_in @user
|
sign_in @user
|
||||||
assert_not_equal @user.name, 'Erik Michaels-Ober'
|
assert_not_equal @user.name, 'New Name'
|
||||||
put :update, :user => {:name => 'Erik Michaels-Ober', :current_password => 'correct'}
|
put :update, :user => {:name => 'New Name', :current_password => 'correct'}
|
||||||
@user.reload
|
@user.reload
|
||||||
assert_equal @user.name, 'Erik Michaels-Ober'
|
assert_equal @user.name, 'New Name'
|
||||||
assert_response :redirect
|
assert_response :redirect
|
||||||
assert_redirected_to :controller => 'hydrants', :action => 'show'
|
assert_redirected_to :controller => 'hydrants', :action => 'show'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'should return error if password is incorrect' do
|
test 'should return error if password is incorrect' do
|
||||||
sign_in @user
|
sign_in @user
|
||||||
put :update, :user => {:name => 'Erik Michaels-Ober', :current_password => 'incorrect'}
|
put :update, :user => {:name => 'New Name', :current_password => 'incorrect'}
|
||||||
assert_response :error
|
assert_response :error
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'should create user if information is valid' do
|
test 'should create user if information is valid' do
|
||||||
post :create, :user => {:email => 'user1@example.com', :name => @user.name, :password => 'correct', :password_confirmation => 'correct'}
|
post :create, :user => {:email => 'user@example.com', :name => 'User', :password => 'correct', :password_confirmation => 'correct'}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'should return error if information is invalid' do
|
test 'should return error if information is invalid' do
|
||||||
post :create, :user => {:email => 'user2@example.com', :name => @user.name, :password => 'correct', :password_confirmation => 'incorrect'}
|
post :create, :user => {:email => 'user@example.com', :name => 'User', :password => 'correct', :password_confirmation => 'incorrect'}
|
||||||
assert_response :error
|
assert_response :error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue