Rails 会话不正确?
我正在使用水豚进行集成测试,看起来传递给我的控制器以进行测试的“登录”部分的会话有问题。通过浏览器时登录工作正常,但在水豚中登录失败。
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
我可以不使用水豚测试符号吗?我的猜测是,在失败的情况下,第一个字段(电子邮件)被填写为两个字段,这就是为什么会话只有电子邮件值,而该值是密码。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来最新版本的水豚不能正确接受符号。仅当输入字段的完整字符串时它才有效。
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.