One subject I have yet to see mentioned on here or in the book is how do you test routes. I know that I can manually hit every URL combo to make sure that the right controller is being hit, but this seems tedious and error prone. Is there a section of the test framework that I''ve missed that allows you to verify that the correct controller is hit, all arguements are being validated, default values being set, etc.? Josh
> One subject I have yet to see mentioned on here or in the book is how > do you test routes. I know that I can manually hit every URL combo to > make sure that the right controller is being hit, but this seems > tedious and error prone. Is there a section of the test framework > that I''ve missed that allows you to verify that the correct controller > is hit, all arguements are being validated, default values being set, > etc.?The Unit Testing manual has what you''re looking for: manuals.rubyonrails.com/read/chapter/28#page236 Specifically: assert_routing ( path, options, defaults={}, extras={}, [msg] ) -- rick techno-weenie.net
On 7/25/05, Rick Olson <technoweenie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The Unit Testing manual has what you''re looking for: > manuals.rubyonrails.com/read/chapter/28#page236 > > Specifically: assert_routing ( path, options, defaults={}, extras={}, [msg] )Thanks for the link Rick, that was useful. Only question that remains is what exactly the extras hash is used for? Looking at the source I can''t quite figure out what it is checking.
On 7/27/05, Josh Knowles <joshknowles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 7/25/05, Rick Olson <technoweenie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > The Unit Testing manual has what you''re looking for: > > manuals.rubyonrails.com/read/chapter/28#page236 > > > > Specifically: assert_routing ( path, options, defaults={}, extras={}, [msg] ) > > Thanks for the link Rick, that was useful. Only question that remains > is what exactly the extras hash is used for? Looking at the source I > can''t quite figure out what it is checking. >I''m not quite sure. Perhaps it''s a hash of options that would normally be translated into GET parameters.