[rspec-users] Stub a controllers helper_method in a view template helper spec

David Chelimsky dchelimsky at gmail.com
Mon Mar 21 13:14:16 EDT 2011


On Mar 21, 2011, at 11:19 AM, Kai Schlamp wrote:

>> Change this ^^ to this:
>> 
>>   helper.fetch_param(:order)
> 
> I was wrong the test fails also with the same error message:
> 
> Failure/Error: order_link(:name)
>     NoMethodError:
>       undefined method `fetch_param' for #<#<Class:0xb63d37ac>:
> 0xb63be118>

That's not the same error message you posted earlier:

NoMethodError:
      undefined method `sort_direction' for
#<RSpec::Core::ExampleGroup::Nested_1

This ^^ message tells us that sort_direction is not implemented on the example. The new message (above) tells us that fetch_param is not implemented on the helper object, which means one of two things:

1) fetch_param is not implemented as an instance method in the ApplicationHelper module. This would be just a matter of implementing it.

2) ApplicationHelper is not included in the helper object. It should be included if the spec file is in spec/helpers. Is it?


More information about the rspec-users mailing list