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

Kai Schlamp kai.schlamp at googlemail.com
Mon Mar 21 17:10:12 EDT 2011


> In the spec, the method being spec'd should be invoked through the helper:
>
>   it "does something" do
>     helper.method_being_specified
>   end
>
> I did not mean to reference a helper object inside the implementation.
>
> Make sense?

Ah, now I got it ... you meant the template helper method (helpers
here and there and everywhere ;-)).

This works fine now:

it "should work" do
  helper.stub(:fetch_param)
  helper.order_link(:name)
end

Thanks a lot for your time and help, David.


More information about the rspec-users mailing list