[rspec-users] named route failing in class spec

David Chelimsky dchelimsky at gmail.com
Sun May 2 09:07:11 EDT 2010


On May 2, 2010, at 1:48 AM, Patrick J. Collins wrote:

> 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?

Whate versions of ruby, rspec, and rails are you using? Please make it a habit to include this information in queries like this.


More information about the rspec-users mailing list