Ruby on rails 3.2 水豚::预期未达标

Ruby on rails 3.2 水豚::预期未达标,ruby-on-rails-3.2,cucumber,Ruby On Rails 3.2,Cucumber,我的功能文件如下所示: Scenario: I am on dashboard area Given I am on dashboard Then I should see link 'All Cases' When I click on 'All Cases' Then I should see be redirected to case index page Given(/^I am on dashboard$/) do visit dashboar

我的功能文件如下所示:

  Scenario: I am on dashboard area
    Given I am on dashboard
    Then I should see link 'All Cases'
    When I click on 'All Cases'
    Then I should see be redirected to case index page
Given(/^I am on dashboard$/) do
  visit dashboard_path
end

Then(/^I should see link 'All Cases'$/) do
  page.should have_content('All Cases')
end
我的步骤定义文件如下所示:

  Scenario: I am on dashboard area
    Given I am on dashboard
    Then I should see link 'All Cases'
    When I click on 'All Cases'
    Then I should see be redirected to case index page
Given(/^I am on dashboard$/) do
  visit dashboard_path
end

Then(/^I should see link 'All Cases'$/) do
  page.should have_content('All Cases')
end
对于出现错误的情况:(RSpec::Expectations::ExpectationNotMetError)

所有案例都只是侧边栏中的链接


关于这个错误,有人能给我建议一下吗。。。尝试了很多,但都不起作用……

语句页面。应该有内容(“所有案例”)只匹配页面上的文本“所有案例”。链接可能有名称“所有案例链接”,页面上的任何文本都不会匹配,即使它可能在页面上。请尝试使用page.should'u link('All Cases')。

如果您给出了完整的错误(即不清楚测试失败的地方)。我写了page.should'u link('All Cases')但是错误仍然是:features/step_definitions/case_steps.rb:9那么我应该看到链接'All Cases'#features/step_definitions/case_steps.rb:13应该找到链接“All Cases”,但没有匹配项(Capybara::ExpectationNotMet)/features/step\u definitions/case\u steps.rb:20:in`/^我应该看到链接'All Cases'$/'