I am using capybara for an integration test and it looks like something is wrong with the session that gets passed to my controller for my "sign in" part of a test. The sign in works fine when going through a browser, but is failing in capybara.
def integration_sign_in(user)
visit signin_path
puts "Pre email: " + user.email
puts "Pre password: " + user.password
# When I use these, everything works correctly
fill_in "session_email", :with => user.email
fill_in "session_password", :with => user.password
# When I use these, the session is wrong
# The params[:session][:email] on the server has the开发者_运维百科 password field
# The params[:session][:password] on the server is nil
#fill_in :email, :with => user.email
#fill_in :password, :with => user.password
click_button "Sign in"
end
Can I not use symbols for the capybara tests? My guess is that the first field (email) is being filled in for both fields in the failing case, which is why the session only has a value for email and that value is password.
It looks like the latest version of capybara doesn't accept symbols correctly. It only works when the full string of the field is entered.
精彩评论