[rspec-users] named route failing in class spec

Patrick J. Collins patrick at collinatorstudios.com
Sun May 2 02:48:23 EDT 2010


I have something like:

class Foo

  def initialize(template)
    @template = template
  end

  def link
    link_to "foo", foo_path
  end

  def method_missing(*args, &block)
    @template.send(*args, &block)
  end
end

...
before(:all) do
  @foo = Foo.new(self)
end

it "should have a link" do
  @foo.link.should match /href/
end
	
...  But I get this error:

NoMethodError in 'FooRenderer should have a link'
undefined method `foo_path' for
#<ActiveSupport::TestCase::Subclass_1:0x105619710>

...  What can I include in my spec to get foo_path to be recognized?

Thank you.

Patrick J. Collins
http://collinatorstudios.com



More information about the rspec-users mailing list