[rspec-users] NameError when passing a URL helper to a method

Zach Dennis zach.dennis at gmail.com
Thu Dec 4 17:06:44 EST 2008


On Thu, Dec 4, 2008 at 3:41 PM, Nick Hoffman <nick at deadorange.com> wrote:
> Hi guys. I just wrote a small spec helper method to DRY up some of my specs,
> and found that passing a URL helper (Eg: #photos_url) to a method results in
> a NameError error. I extracted the problem into its own short spec file to
> isolate it. Any thoughts on what's going on?:
> http://gist.github.com/32060

foo(properties_url) is being executed in the context of the describe
block and not in the instance of an example being run. For example:

describe FooController do
   it "has access to routing methods here" do
      properties_url
   end

   # it doesn't have access out here though, this fails
   properties_url

   # your example will fail to
  foo(properties_url)
end


-- 
Zach Dennis
http://www.continuousthinking.com
http://www.mutuallyhuman.com


More information about the rspec-users mailing list