Matt Wynne
2008-Sep-12 16:17 UTC
[rspec-users] booting rails routing without a controller call
We''re getting into some quite complex routing, and I''d like to be able to spec the routing on its own. All our controllers tend to have a little call to like this to boot up the routing before testing params_from etc: get :index However I can''t get this to work in a spec that doesn''t start with describe SomeController. Does anyone know how to get the routing loaded up without actually calling a controller? cheers, Matt ---- http://blog.mattwynne.net http://songkick.com In case you wondered: The opinions expressed in this email are my own and do not necessarily reflect the views of any former, current or future employers of mine. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080912/b5ce5eb7/attachment.html>
David Chelimsky
2008-Sep-12 16:21 UTC
[rspec-users] booting rails routing without a controller call
On Fri, Sep 12, 2008 at 11:17 AM, Matt Wynne <matt at mattwynne.net> wrote:> We''re getting into some quite complex routing, and I''d like to be able to > spec the routing on its own. > All our controllers tend to have a little call to like this to boot up the > routing before testing params_from etc: > get :index > However I can''t get this to work in a spec that doesn''t start with describe > SomeController. > Does anyone know how to get the routing loaded up without actually calling a > controller?Should work if the file lives in spec/controllers. If not, you can do this: describe "blah routing", :type => :controller do .. end> cheers, > Matt > ---- > http://blog.mattwynne.net > http://songkick.com > In case you wondered: The opinions expressed in this email are my own and do > not necessarily reflect the views of any former, current or future employers > of mine. > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Matt Wynne
2008-Sep-13 00:32 UTC
[rspec-users] booting rails routing without a controller call
Worked perfectly, thank you. By moving our routes config into lib/routing/default_routes.rb, I can also get autotest to watch the file for changes - double bonus! On 12 Sep 2008, at 17:21, David Chelimsky wrote:> On Fri, Sep 12, 2008 at 11:17 AM, Matt Wynne <matt at mattwynne.net> > wrote: >> We''re getting into some quite complex routing, and I''d like to be >> able to >> spec the routing on its own. >> All our controllers tend to have a little call to like this to >> boot up the >> routing before testing params_from etc: >> get :index >> However I can''t get this to work in a spec that doesn''t start with >> describe >> SomeController. >> Does anyone know how to get the routing loaded up without actually >> calling a >> controller? > > Should work if the file lives in spec/controllers. If not, you can > do this: > > describe "blah routing", :type => :controller do > .. > end > > >> cheers, >> Matt >> ---- >> http://blog.mattwynne.net >> http://songkick.com >> In case you wondered: The opinions expressed in this email are my >> own and do >> not necessarily reflect the views of any former, current or future >> employers >> of mine. >> >> >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-userscheers, Matt ---- http://blog.mattwynne.net http://songkick.com In case you wondered: The opinions expressed in this email are my own and do not necessarily reflect the views of any former, current or future employers of mine.