Ruby on rails 将水豚与Desive一起使用?
我正试图使用水豚为我的app+Desive编写一个登录集成测试 以下是我到目前为止的情况:Ruby on rails 将水豚与Desive一起使用?,ruby-on-rails,ruby-on-rails-3,rspec,devise,capybara,Ruby On Rails,Ruby On Rails 3,Rspec,Devise,Capybara,我正试图使用水豚为我的app+Desive编写一个登录集成测试 以下是我到目前为止的情况: require 'spec_helper' describe "the signup process", :type => :request do before :each do @user_1 = Factory.create(:user, :email => 'bob@golden.com', :password => 'iPassword') end it
require 'spec_helper'
describe "the signup process", :type => :request do
before :each do
@user_1 = Factory.create(:user, :email => 'bob@golden.com', :password => 'iPassword')
end
it "signs me in" do
visit new_user_session_path
fill_in 'user[email]', :with => 'bob@golden.com'
fill_in 'user[password]', :with => 'iPassword'
click_link_or_button 'Sign In'
end
end
这是过去。这里的问题是,它没有检查用户是否已登录(cookie?)以及url是否正确重定向
如何将这些详细信息添加到此测试中?此外,对于无效登录,我如何测试以确保闪存警报设置正确
谢谢单击链接或按钮“登录”后添加:
current_path.should == 'your path'
page.should have_content("Signed in successfully.")
/support/designe.rb
RSpec.configure do |config|
config.include Devise::TestHelpers, :type => :controller
end
谢谢,我正在看日志。出于某种原因,它正在重定向到example.com有什么想法吗?你有designe.rb吗?添加到答案中。我刚刚将其添加到:spec/support/designe.rb,这在以前是不存在的。现在就开始尝试。。。stackoverflow会让您等待几分钟。我真的很讨厌那没问题。很高兴我能帮忙