I am trying to get used to BDD with Cucumber and I wrote a few features already but this one in particular I am confused about, here is the error:
Scenario: # features/viewing_posts.feature:6
Given there is a post with the title "Just another day at the beach" # features/step_definitions/post_steps.rb:1
And I am on the homepage # features/step_definitions/web_steps.rb:44
When I follow "Just another day at the beach" # features/step_definitions/web_steps.rb:56
Then I should be on the post page for "Just another day at the beach" # features/step_definitions/web_steps.rb:230
Can't find mapping from "the post page for "Just another day at the beach"" to a path.
Now, go and add a mapping in /Users/jeff/rails_projects/jeffc/features/support/paths.rb (RuntimeError)
./features/support/paths.rb:29:in `rescue in path_to'
./features/support/paths.rb:23:in `path_to'
./features/step_definitions/web_steps.rb:233:in `/^(?:|I )should be on (.+)$/'
features/viewing_posts.feature:10:in `Then I should be on the post page for "Just another day at the beach"'
Failing Scenarios:
cucumber features/viewing_posts.feature:6 # Scenario:
I checked my web_steps.rb in that error and I have the step that should match.
Then /^(?:|I )should be on (.+)$/ do |page_name|
current_path = URI.parse(current_url).path
if current_path.respond_to? :should
current_path.should == path_to(page_name)
else
assert_equal path_to(page_name), current_path
end
end
It’s passing up until the “Then I should be on the post page…”
Can anyone suggest what’s going on with this?
Thanks
J
It’s expecting to find a path mapping in
paths.rbYou might need to move it. Do your other tests have this same issue by chance, or do they work with what you’ve already got?