Hi,
I would like to use the ‘lazy’ style of url generation in my views,
omitting parameters from my calls to url_for (and named route
methods) that are then filled in from the current request parameters.
Example:
url_for(:action => ‘index’) will fill in (:controller => ‘posts’) if
params[:controller] is ‘posts’
However, this breaks my view specs because when they render the view
there is no request from which to fill in the missing parameters. How
can I stub/mock the request so that the ‘lazy’ url-generation works
in view spec? I tried a number of things, none of them working,
including this:
@controller.stub!(:params).and_return({:controller =>
‘posts’, :action => ‘show’})
Ingo