Login 水豚测试无法登录

Login 水豚测试无法登录,login,capybara,Login,Capybara,当我使用rake spec:requests执行时 我无法登录,浏览器中出现无效电子邮件或密码错误。 请告诉我该怎么做?它是否适用于现有用户的凭据,而不是新创建的用户的凭据? describe "create post", :js => true do before :each do a = User.create!(:email => 'any@gmail.com', :password => 'admin123', :password_confirmation =&

当我使用rake spec:requests执行时

我无法登录,浏览器中出现无效电子邮件或密码错误。
请告诉我该怎么做?

它是否适用于现有用户的凭据,而不是新创建的用户的凭据?
describe "create post", :js => true do
  before :each do
  a = User.create!(:email => 'any@gmail.com', :password => 'admin123', :password_confirmation => 'admin123', :firstname => "black")
  a.confirm!
end

it "signs me in" do

  get root_path
  visit '/'
   within(".form-inline") do
     fill_in 'Email', :with => 'any@gmail.com'
     fill_in 'Password', :with => 'admin123'        
   end
   click_button 'Sign in'

    save_and_open_page
  end
 end