Consider following situation: you’ve got controller Foo that has
following routing rules related:
map.connect ‘/foo’, :controller => ‘foo’, :action => ‘index’
map.foo ‘/foo/:x/:y/:z/:action’, :controller => ‘foo’
You want all Foo actions to make use of partial url rewriting, so
instead of writing:
params[:x], params[:y] and params[:z] contain action parameters
redirect_to :action => ‘baz’, :x => params[:x], :y => params[:y], :z
you could write just
redirect_to :action => ‘baz’
and have all those x, y and z parameters inherited from bar action.
So far, rails has that feature available.
Then you write a functional test something like this:
get :bar, :x => 1, :y => 5, :z => 2
assert_redirected_to :action => :baz, :x => 1, :y => 5, :z => 2
As far as I see, now assert_redirected_to only matches parameters
supplied to it with parameters supplied to redirect_to method. I think,
that assert should work something like this:
- construct url with parameters supplied for redirect_to method
- ask routing to recognize the url and get the parameters
- match resulting parameters with parameters supplied for
Any objections ?