水豚测试用户sign_in

时间:2013-09-17 09:03:38

标签: ruby-on-rails rspec-rails

我遇到了测试用户登录procces

的问题

这是我的测试

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

0 个答案:

没有答案