Topic: Cucumber - NoMethodError [RESOLVED]

I'm trying to get started with cucumber and I'm having routing(?) problems with the following code:

#manage_users.feature
Feature: Manage Users
  In order to have a site with login
  As a site administrator
  I want to create and manage users information
  
  Scenario: Users List
    Given I have users titled bob, joe
    When I go to the list of users
    Then I should see "bob"
    And I should see "joe"
#users.rb
Given /^I have users titled (.+)$/ do |names|
  names.split(', ').each do |name|
    User.create!(:login => name)
  end
end
#paths.rb
def path_to(page_name)
    case page_name
    
    when /the home\s?page/
      '/'
    
    when /the list of users/
      users_path
# ...

When I run cucumber, it can't find the path. Here's the full error spit out:

When I go to the list of users     # features/step_definitions/web_steps.rb:17
      undefined method `users_path' for #<ActionController::Integration::Session:0x2fb3ad8> (NoMethodError)
      ./features/support/paths.rb:15:in `path_to'
      ./features/step_definitions/web_steps.rb:18:in `/^(?:|I )go to (.+)$/'
      features/manage_users.feature:8:in `When I go to the list of users'

I even tried it with "the homepage" instead of "the list of users" and got the following error:

    When I go to the homepage          # features/step_definitions/web_steps.rb:17
      No route matches "/" with {:method=>:get} (ActionController::RoutingError)
      <internal:prelude>:8:in `synchronize'
      ./features/support/ruby191_patch.rb:71:in `process'
      (eval):2:in `visit'
      ./features/step_definitions/web_steps.rb:18:in `/^(?:|I )go to (.+)$/'
      features/manage_users.feature:8:in `When I go to the homepage'

I haven't found anything recent about this error on google. Maybe you guys can help me out. It doesn't seem like it should be this hard.

Last edited by CPFB (2009-12-30 02:19:34)

Re: Cucumber - NoMethodError [RESOLVED]

I don't know what happened, but I reset my terminal and everything works now.

Sorry to waste anyone's time. tongue