Reputation: 5526
I have the following scenario in feature:
@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
Am seeing 2 problems:
1) When I run rake cucumber --tags @home
, it throws an error: invalid option: --tags
So, I run with cucumber --tags @home
2) It is throwing the following error:
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'
However, when I launch and see in browser, I can see and click the link and I verified the step to make sure there are no spelling mistakes or extra spaces.
Can some one help me how I can debug this?
Steps:
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
Upvotes: 0
Views: 258
Reputation: 21564
You can try debugging your app by adding save_and_open_page
right before the page.should have_link
clause. That will open a browser page and you'll see what cucumber 'sees' right before it checks for your expectation.
Upvotes: 1