0

我在测试用户登录过程时遇到了问题

这是我的测试

require 'spec_helper'
include Warden::Test::Helpers
include Devise::TestHelpers

describe "UserSignin" do
  it "should allow a registered user to sign in" do
    user = FactoryGirl.create(:employer, :email => "email@email.com")
    user.confirm! 
    visit "/users/sign_in"
    fill_in "Email", :with => user.email
    fill_in "Password", :with => "12345678"
    click_button "Sign in"
    current_path.should == '/employer'
    expect(page).to have_content('My Account')
  end
end

如果这很重要,我正在使用设备进行身份验证

在工厂我也有:employer工厂

身份验证问题

点击后sign_in我有一个错误invalid email or password

更新

规范助手中的测试环境配置有问题

解决方案是设置:

DatabaseCleaner.strategy = :truncation

4

0 回答 0