Hi there
I''m having difficulty succesfully updating attributes via a post
request in a functional test.
Here''s some pastes:
######################################
# account_controller.rb
def edit_details
@user = User.find(self.current_user.id)
return unless request.post?
if @user.update_attributes(params[:user])
flash[:notice_good] = ''Your account details were successfully
updated.''
redirect_to :action => ''index''
else
render :action => ''edit_details''
end
end
# account_controller_test.rb
def test_should_update_user
# login as valid user
post :login, :email => ''quentin@example.com'', :password
=> ''test''
assert session[:user]
get :edit_details
assert_response :success
post :edit_details, :first_name => ''Richard''
assert_equal ''Richard'', assigns(:current_user).first_name
assert_equal "Your account details were successfully updated.",
flash[:notice_good]
end
# test output
24: <"Richard"> expected but was <"quentin">.
######################################
So for some reason ''Richard'' is not getting updated as
first_name for
my user object.
I''m sure the issue here is my test not my controller.
Any clues would be appreciated.