[rspec-users] Stub a controllers helper_method in a view template helper spec
kai.schlamp at googlemail.com
Mon Mar 21 13:52:14 EDT 2011
> > Failure/Error: order_link(:name)
> > NoMethodError:
> > undefined method `fetch_param' for #<#<Class:0xb63d37ac>:
> > 0xb63be118>
> That's not the same error message you posted earlier:
> undefined method `sort_direction' for
The "#<#<Class:0xb63d37ac>" error shows up when using
helper.check_param in the order_link method as you suggested. The
"#<RSpec::Core::ExampleGroup::Nested_1" shows up with just using
check_param (without "helper.").
> 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.
It should be. It works when viewing that template in the browser.
> 2) ApplicationHelper is not included in the helper object. It should be included if the spec file is in spec/helpers. Is it?
order_link is known and that is a method of ApplicationHelper, so I
guess it is included.
More information about the rspec-users