Topic: `path_to' Cucumber:: NoMethodError

undefined method `path_to' for #<Cucumber::Rails::World:0x007fc27ab5f1f0> (NoMethodError)


i am getting this error when i run Cucumber
i dont know where i should define this

Re: `path_to' Cucumber:: NoMethodError

Based on below article, I would put it in features/support/paths.rb

http://levycarneiro.com/2009/02/cucumbe … it-method/

Re: `path_to' Cucumber:: NoMethodError

Thanks its not helping me

let me give some of my code

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



output

cucumber features/login.feature
Using the default profile...
Feature: login  Users
    Inorder for people to have the proper access to there account

  Scenario: successful login                   # features/login.feature:4
    Given I am the registered user Test User   # features/step_definitions/login.rb:10
    And I am on the login page                 # features/step_definitions/login.rb:3
    When I login with valid credentials        # features/step_definitions/login.rb:22
    Then I should be on the root page          # features/step_definitions/login.rb:32
      undefined method `path_to' for #<Cucumber::Rails::World:0x007fe83503ec18> (NoMethodError)
      ./features/step_definitions/login.rb:36:in `/^I should be on ([^\"]*)$/'
      features/login.feature:8:in `Then I should be on the root page'
    And I should see "Signed in successfully." # features/step_definitions/visitor_views_site_features.rb:13

Failing Scenarios:
cucumber features/login.feature:4 # Scenario: successful login

1 scenario (1 failed)
5 steps (1 failed, 1 skipped, 3 passed)
0m0.339s