search for: route_for

Displaying 14 results from an estimated 14 matches for "route_for".

2007 Nov 21
6
route_for and nested resources
I can''t figure out how to make the updates to allow for the route_form method to return a url that matches the expected. Here is a sample route_for(:controller => :task, :action => :new).should == "/task/new" If a task has to be created for a user, how exactly do I do this. The following doesn''t work: route_for(:controller => :task, :ac...
2009 May 02
10
Problem verifying routing error
...uests are allowed). But that error wasn''t detected. When I skip the lambda, and just ask it to verify that the route does exist (which *should* fail), I get the same result for those :except actions as for a made-up action name. Seems this must have something to do with the change in how route_for delegates back to ActionController''s routing assertion (sez the backtrace :). NoMethodError in ''ItemsController route generation should NOT map #indewfefwex'' You have a nil object when you didn''t expect it! You might have expected an instance of Array. The erro...
2009 Mar 02
2
Changes in specs for routes in rspec 1.1.99.x
Trying the next release of rspec, I have had to make changes in the existing specs for routing. I have written an script with sed that makes this automatically (two files) spec/upgrade.sed ================ /route_for/s/id => 1/id => "1"/g /route_for.*create/s/== \(["''].*["'']\)/== {:path => \1, :method => :post}/ /route_for.*update/s/== \(["''].*["'']\)/== {:path => \1, :method => :put}/ /route_for.*destroy/s/== \(["''...
2010 Aug 30
1
undefined method `route_for' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:
...quire ''spec_helper'' describe PostsController do render_views describe "route generation" do it "should be successful" do @post = Post.new(:title => ''blalbla'', :name => ''adfsdfsdf'') @post.save route_for(:controller => "posts", :action => "show", :id => @post.id, :method => ''GET'').should == "/posts/show" + @post.id.to_s end end end I have Post model and it works just fine (rspec tested fine as well). And the route is (from rake rout...
2007 Aug 31
2
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?...
2007 Mar 27
1
REST rspec_generator
...eason that the rspec resource generator produces code like this: context "Routes for the AnimalsController should map" do controller_name :animals specify "{ :controller => ''animals'', :action => ''index'' } to / animals" do route_for(:controller => "animals", :action => "index").should == "/animals" end ... end and not like this: describe "The AnimalsController" do it "should have an index route" do route_for(hash_for_animals_url).should == "/animals&...
2007 Dec 16
3
how do I spec my Rails routes?
Once again, here''s something I haven''t figured out. Apologies if this is too newb-ish, but, how do I spec my routes using RSpec-Rails? In particular, I''ve got a catch-all route that needs to catch a wide variety of URLs: map.document ''*url'', :controller => ''documents'', :action => ''show'' Is there a way to
2009 Mar 17
1
Route failure with Rails2.3 and rspec1.2
Hello all, I have a spec for a route that used to pass under Rails 2.2.2 and rspec 1.1.12, but can?t figure out what is wrong since I updated. Here is the assertion: route_for( { :controller => ''purchase_orders'', :action => ''update'', :company_id => "32", :id => ''1'' }).should == "/companies/32/...
2009 Mar 15
0
rspec-rails 1.2.0 Released
...s-compatibility-breaking changes. * rspec-rails supports rails 2.0.5, 2.1.2 and 2.2.2, and 2.3.1 * We are no longer supporting 1.x versions of rails. * expect_render and stub_render have been removed. * Both of these methods were deprecated in rspec-rails-1.1.5, released in Sept, 2008. * { route_for(args).should == "/path" } now delegates to assert_generates (in rails) * see Upgrade.markdown for more information * deprecations * controller.use_rails_error_handling! is deprecated * use rescue_action_in_public! (from rails) instead * enhancements * Adding status codes to...
2007 Sep 22
1
Testing RESTful routes
...'':controller/:action/:id'' When I did this however all of my routing specs broke. I have been testing my routes like the rspec-scaffold generator tests them: it "{ :controller => ''users'', :action => ''new'' } to /users/new" do route_for(:controller => "users", :action => "new").should == "/users/new" end To get around this the easiest thing I could think of was to add this to my routes.rb: if RAILS_ENV=="test" map.connect '':controller/:action/:id.:format'' m...
2007 Jul 02
6
Testing route globbing and limitations of get()
...tried to do my homework. To answer my questions, I searched this list''s archives, the Rails API, and Google, to no avail. Therefor, I''d be grateful if someone could point me in the right directions: 1) There doesn''t seem to be a counterpart to assert_recognizes in rspec. route_for() won''t work with route globbing (or will it?) So, how do I test route globbing? 2) Still using route globbing, if I do get ''/something/somewhere'' rspec will complain that it couldn''t find an action for ''/something/somewhere''. I suppose this...
2007 Nov 07
0
Named routes raising nil.rewrite error
...ct it! The error occurred while evaluating nil.rewrite (eval):19:in `snippet_version_url'' ./spec/controllers/regressions/2007_11_07_snippets_route_spec.rb:277: ./script/spec:4: Finished in 0.029341 seconds 1 example, 1 failure ======================================== Should I be using route_for here? I''ve noticed that the following spec fails: ======================================== describe SnippetsController, "routes" do it "should not raise an error with the snippet_version_url route" do lambda { snippet_version_url }.should_not ra...
2008 Jun 25
0
Rspec routing_spec failing on nested singular resource
...ch the routes, for example; # The spec describe ProfileController do describe "route generation" do it "should map { :controller => ''profile'', :action => ''show'', :user_id => ''1'' } to /user/1/profile" do route_for(:controller => "profile", :action => "show", :user_id => 1).should == "/user/1/profile" end # The failed spec message should map { :controller => ''profile'', :action => ''show'', :user_id => ''1''...
2007 Sep 14
2
Testing a nested controller
Hey everyone. I really stuck on testing a nested controller. I''m trying to make a request using get and afterwards checking the response by response.should ... My routes.rb looks like this: map.resources :writers do |writers| writers.resources :notes end In my notes_controller_spec.rb def do_get writer_id = 1 note_id = 1 get note_path(writer_id, note_id) end it "should show