将水豚与 Devise 一起使用?
我正在尝试使用 Capybara 为我的应用程序+设备编写登录集成测试。
到目前为止,这是我所得到的:
require 'spec_helper'
describe "the signup process", :type => :request do
before :each do
@user_1 = Factory.create(:user, :email => '[email protected]', :password => 'iPassword')
end
it "signs me in" do
visit new_user_session_path
fill_in 'user[email]', :with => '[email protected]'
fill_in 'user[password]', :with => 'iPassword'
click_link_or_button 'Sign In'
end
end
这一切都过去了。这里的问题是它没有检查用户是否已登录(cookie?)以及 URL 是否正确重定向?
我如何将这些详细信息添加到此测试中?另外,对于无效登录,我如何测试以确保闪光警报设置正确?
谢谢
I'm trying to write a Sign in integration test for my app + devise by using Capybara.
Here is what I have so far:
require 'spec_helper'
describe "the signup process", :type => :request do
before :each do
@user_1 = Factory.create(:user, :email => '[email protected]', :password => 'iPassword')
end
it "signs me in" do
visit new_user_session_path
fill_in 'user[email]', :with => '[email protected]'
fill_in 'user[password]', :with => 'iPassword'
click_link_or_button 'Sign In'
end
end
This is passing. Problem here is that it isn't checking that the user was signed in (cookie?) and that the url redirected correctly?
How can I add those details to this test? Also for an invalid login, how can I test to make sure the flash alert was set correctly?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 click_link_or_button“登录”后添加:
/support/devise.rb
After click_link_or_button 'Sign In' add:
/support/devise.rb