Hi, just wondering why it makes sense to verify routing in an AC::TestCase test. class XX < ActionController::TestCase it "returns an empty cart" do post :create ... end end If I have no routing set up: Failure/Error: post :create, :format => "json" No route matches {:controller=>"carts", :action=>"create"} Since I only wanna test my controller action why would I need routing? Any hints on this, or is this just a relict that can be removed? Nick -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
On 4 January 2012 17:13, Nick Sutterer <apotonick@gmail.com> wrote:> Hi, just wondering why it makes sense to verify routing in an > AC::TestCase test. > > class XX < ActionController::TestCase > it "returns an empty cart" do > post :create > ... > end > end > > > If I have no routing set up: > > Failure/Error: post :create, :format => "json" > No route matches {:controller=>"carts", :action=>"create"} > > Since I only wanna test my controller action why would I need routing? > Any hints on this, or is this just a relict that can be removed?What would be the purpose of a controller action without a route to it? There would be no way to invoke the action either from a test or from a browser. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
That''s why there are route tests, right? On Wed, Jan 4, 2012 at 3:20 PM, Colin Law <clanlaw@googlemail.com> wrote:> On 4 January 2012 17:13, Nick Sutterer <apotonick@gmail.com> wrote: > > Hi, just wondering why it makes sense to verify routing in an > > AC::TestCase test. > > > > class XX < ActionController::TestCase > > it "returns an empty cart" do > > post :create > > ... > > end > > end > > > > > > If I have no routing set up: > > > > Failure/Error: post :create, :format => "json" > > No route matches {:controller=>"carts", :action=>"create"} > > > > Since I only wanna test my controller action why would I need routing? > > Any hints on this, or is this just a relict that can be removed? > > What would be the purpose of a controller action without a route to > it? There would be no way to invoke the action either from a test or > from a browser. > > Colin > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > >-- Luiz Felipe G. Pereira -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
On 4 Jan., 18:20, Colin Law <clan...@googlemail.com> wrote:> On 4 January 2012 17:13, Nick Sutterer <apoton...@gmail.com> wrote: > > > > > Hi, just wondering why it makes sense to verify routing in an > > AC::TestCase test. > > > class XX < ActionController::TestCase > > it "returns an empty cart" do > > post :create > > ... > > end > > end > > > If I have no routing set up: > > > Failure/Error: post :create, :format => "json" > > No route matches {:controller=>"carts", :action=>"create"} > > > Since I only wanna test my controller action why would I need routing? > > Any hints on this, or is this just a relict that can be removed? > > What would be the purpose of a controller action without a route to > it? There would be no way to invoke the action either from a test or > from a browser. >Found out the existing route is required to compute the current simulated request URL, so maybe you''re right. Thx> Colin-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.