Edgar Gonzalez
2007-Aug-31 15:49 UTC
[rspec-users] How to spec routes for a resource nested in multiples resources?
Hi, I got the resource "Llamadas" nested in: - Operadores - Productos - Centros Here is part of my routes http://pastie.caboo.se/92767 I want to spec that the routes for Llamadas, I tried several approachs: - route_for(:controller => "llamadas", :action => "exitosas", :operador_id => 1).should == "/operador/1/llamadas;exitosas" - controller.send(:operador_exitosas_llamadas_path, at operador).should == "/operador/22/llamadas;exitosas" but nothing works. any clue? thanks in advance -- Edgar Gonz?lez Gonz?lez E-mail: edgargonzalez at gmail.com http://www.hasmanydevelopers.com http://www.rubycorner.com http://www.to2blogs.com http://www.lacaraoscura.com --
David Chelimsky
2007-Sep-01 14:10 UTC
[rspec-users] How to spec routes for a resource nested in multiples resources?
On 8/31/07, Edgar Gonzalez <edgargonzalez at gmail.com> wrote:> Hi, > > I got the resource "Llamadas" nested in: > - Operadores > - Productos > - Centros > > Here is part of my routes http://pastie.caboo.se/92767 > > I want to spec that the routes for Llamadas, I tried several approachs: > > - route_for(:controller => "llamadas", :action => "exitosas", > :operador_id => 1).should == "/operador/1/llamadas;exitosas"route_for wraps ActionController::Routing::Routes.generate(options), so whatever route_for is producing is what rails actually produces. You may want to ask on the Rails list how people are approaching this w/ test/unit. If you get an answer, please report it back here. Cheers, David> > - controller.send(:operador_exitosas_llamadas_path, at operador).should > == "/operador/22/llamadas;exitosas" > > but nothing works. > > any clue? > > thanks in advance > -- > Edgar Gonz?lez Gonz?lez > E-mail: edgargonzalez at gmail.com > http://www.hasmanydevelopers.com > http://www.rubycorner.com > http://www.to2blogs.com > http://www.lacaraoscura.com > -- > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
rupert
2007-Sep-01 14:54 UTC
[rspec-users] How to spec routes for a resource nested in multiples resources?
> On 8/31/07, Edgar Gonzalez <edgargonzalez at gmail.com> wrote: >> Hi, >> >> I got the resource "Llamadas" nested in: >> - Operadores >> - Productos >> - Centros >> >> Here is part of my routes http://pastie.caboo.se/92767 >> >> I want to spec that the routes for Llamadas, I tried several >> approachs: >> >> - route_for(:controller => "llamadas", :action => "exitosas", >> :operador_id => 1).should == "/operador/1/llamadas;exitosas" > > route_for wraps ActionController::Routing::Routes.generate(options), > so whatever route_for is producing is what rails actually produces. > You may want to ask on the Rails list how people are approaching this > w/ test/unit. If you get an answer, please report it back here.another suggestion... you could take the code from http://pastie.caboo.se/74249 and paste it into a file called (say) routes.rake in your lib/tasks directory then run rake routes to get a listing of all the routes and their mappings in your terminal window. This will show you how the controllers, actions and parameters are mapped to urls and might help you work out what''s going on. Cheers Rupert