Ruby on rails 设备注销不工作的功能测试用例

Ruby on rails 设备注销不工作的功能测试用例,ruby-on-rails,rspec,devise,Ruby On Rails,Rspec,Devise,我正在使用Rspec和capibara在Rails 4中制作的项目中编写测试用例。问题是,尽管我已经为注销特性编写了测试用例,但它给了我一个错误。下面是我的测试用例 # Feature: Sign out # As a user # I want to sign out # So I can protect my account from unauthorized access feature 'Sign out', :devise do # Scenario: User signs out s

我正在使用Rspec和capibara在Rails 4中制作的项目中编写测试用例。问题是,尽管我已经为注销特性编写了测试用例,但它给了我一个错误。下面是我的测试用例

# Feature: Sign out
# As a user
# I want to sign out
# So I can protect my account from unauthorized access
feature 'Sign out', :devise do
# Scenario: User signs out successfully
# Given I am signed in
# When I sign out
# Then I see a signed out message
  scenario 'applicant signs out successfully' do
    applicant = FactoryGirl.create(:applicant)
    signin(applicant.email, applicant.password)
    expect(page).to have_content I18n.t 'devise.sessions.signed_in'
    click_link 'Sign out'
    expect(page).to have_content I18n.t 'devise.sessions.signed_out'
  end
end
我的视图代码

<h2>Log in</h2>

<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
    <%= devise_error_messages! %>
    <div class="field">
        <%= f.label :email %><br />
        <%= f.email_field :email, autofocus: 'true' %>
    </div>

    <div class="field">
        <%= f.label :password %><br />
        <%= f.password_field :password, autocomplete: "off" %>
    </div>

    <% if devise_mapping.rememberable? -%>
        <div class="field">
          <%= f.check_box :remember_me %>
          <%= f.label :remember_me %>
        </div>
    <% end -%>

    <div class="actions">
        <%= f.submit "Log in" %>
    </div>
<% end %>

似乎登录不起作用。
signin
方法是什么样子的?@JakobW我已经编辑了我的问题,添加了signin方法的代码。现在我看到,当您尝试登录时,designe会给您发送一条消息:“您必须先确认您的电子邮件地址,然后再继续”。因此,可能很简单,只需在
1) Sign out applicant signs out successfully
     Failure/Error: expect(page).to have_content I18n.t 'devise.sessions.signed_in'
       expected to find text "Signed in successfully." in "Sign up or Sign in You have to confirm your email address before continuing. Log in Email Password Remember me Sign up Forgot your password? Didn't receive confirmation instructions? Didn't receive unlock instructions?"
     # ./spec/features/applicants/sign_out_spec.rb:13:in `block (2 levels) in <top (required)>'
module Features
  module SessionHelpers
    def sign_up_with(email, password, confirmation)
      visit new_applicant_registration_path
      fill_in 'Email', with: email
      fill_in 'Password', with: password
      fill_in 'Password confirmation', :with => confirmation
      click_button 'Sign up'
    end
    def signin(email, password)
      visit new_applicant_session_path
      fill_in 'Email', with: email
      fill_in 'Password', with: password
      click_button 'Log in'
    end
  end
end