[rspec-devel] [ rspec-Bugs-6541 ] catch-22 using named routes

noreply at rubyforge.org noreply at rubyforge.org
Tue Nov 7 09:39:03 EST 2006


Bugs item #6541, was opened at 2006-11-07 09:39
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6541&group_id=797

Category: rails plugin
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: catch-22 using named routes

Initial Comment:
The recommended way specify controller redirects is to use

  controller.should_redirect_to 'path or hash'

*before* calling the action.

However, you cannot use named routes (XXX_url) until the action has been called (it gives 'rewrite' undefined for nil when it tries to call an instance variable in the controller).  

Can the mock be improved sufficiently to allow named routes to work in advance of the action? 

One workaround is to instantiate an ActionController::Integration::Session and delegate the named routes to that.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6541&group_id=797


More information about the rspec-devel mailing list