Forum: RSpec Cucumber resource routes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3203ed0e608d3bfae1e31282e629ffa2?d=identicon&s=25 Peter Fitzgibbons (Guest)
on 2009-01-30 15:13
(Received via mailing list)
Hi all,

I'm missing something basic here.

Inside ./features/support/paths.rb I want to use a
ActionController::Resources helper for Products as mapped in routes.rb

./routes.rb
map.resource :product

./features/support/paths.rb (abbreviated for clarity)
def path_to(page_name)
  case page_name
  when /Product (\d+)/
    project_path(:id => $1)
  else
    raise "Can't find mapping from \"#{page_name}\" to a path."
  end
end

rake features
    Given I go to Product 1 page         #
features/step_definitions/webrat_steps.rb:6
      undefined method `project_path' for
#<ActionController::Integration::Session:0xb6eec0d0> (NoMethodError)

So, can someone tell me the horribly obvious that I've missed?

Peter Fitzgibbons
(847) 687-7646
Email: peter.fitzgibbons@gmail.com
IM GTalk: peter.fitzgibbons
IM Yahoo: pjfitzgibbons
IM MSN: pjfitzgibbons@hotmail.com
IM AOL: peter.fitzgibbons@gmail.com
978ed7ca309d5495078702096f9add03?d=identicon&s=25 Thomas r. Koll (tomk32)
on 2009-01-30 15:43
(Received via mailing list)
Hi,

uhmmm 'project'.should be('product')


Am 30.01.2009 um 15:10 schrieb Peter Fitzgibbons:

> ./features/support/paths.rb (abbreviated for clarity)
>     Given I go to Product 1 page         # features/step_definitions/
> webrat_steps.rb:6
>       undefined method `project_path' for
> #<ActionController::Integration::Session:0xb6eec0d0> (NoMethodError)
>
> So, can someone tell me the horribly obvious that I've missed?

--
Thomas R. "TomK32" Koll <> http://ananasblau.com
just a geek trying to change the world
http://github.com/TomK32
5d38ab152e1e3e219512a9859fcd93af?d=identicon&s=25 David Chelimsky (Guest)
on 2009-01-30 15:55
(Received via mailing list)
On Fri, Jan 30, 2009 at 8:10 AM, Peter Fitzgibbons
<peter.fitzgibbons@gmail.com> wrote:
> ./features/support/paths.rb (abbreviated for clarity)
>     Given I go to Product 1 page         #
> features/step_definitions/webrat_steps.rb:6
>       undefined method `project_path' for
> #<ActionController::Integration::Session:0xb6eec0d0> (NoMethodError)
>
> So, can someone tell me the horribly obvious that I've missed?

map.resource :product
project_path(:id => $1)

product != project
3203ed0e608d3bfae1e31282e629ffa2?d=identicon&s=25 Peter Fitzgibbons (Guest)
on 2009-01-30 18:17
(Received via mailing list)
See, I told you it was horribly obvious!

*blush*

Thanks Thomas, David.

Peter Fitzgibbons
(847) 687-7646
Email: peter.fitzgibbons@gmail.com
IM GTalk: peter.fitzgibbons
IM Yahoo: pjfitzgibbons
IM MSN: pjfitzgibbons@hotmail.com
IM AOL: peter.fitzgibbons@gmail.com
This topic is locked and can not be replied to.