0

我在功能中有以下场景:

@home
Feature: Home page

@home
Scenario: User launches home page
  Given a user visits the home page
  And user is not signed in
  Then he should see user signin information

我看到 2 个问题:1)当我运行时rake cucumber --tags @home,它会引发错误:invalid option: --tags

所以,我运行cucumber --tags @home 2)它抛出以下错误:

Given a user visits the home page             # features/step_definitions/home_steps.rb:2
And user is not signed in                     # features/step_definitions/home_steps.rb:23
Then he should see user signin information    # features/step_definitions/home_steps.rb:6
  expected link "User Sign In" to return something (RSpec::Expectations::ExpectationNotMetError)
  ./features/step_definitions/home_steps.rb:8:in `/^he should see user signin information$/'
  features/home.feature:8:in `Then he should see user signin information'

但是,当我在浏览器中启动并查看时,我可以看到并单击链接,并且我验证了该步骤以确保没有拼写错误或多余的空格。

有人可以帮助我如何调试它吗?

脚步:

Given /^a user visits the home page$/ do
  visit home_path
end
Given /^user is not signed in$/ do

end

Then /^he should see user signin information$/ do
  page.should have_link('User Sign In', href: user_signin_path)
end
4

1 回答 1

1

您可以尝试通过在子句save_and_open_page之前添加来调试您的应用程序。page.should have_link这将打开一个浏览器页面,您将看到黄瓜在检查您的期望之前“看到”了什么。

于 2012-09-14T01:11:28.597 回答