Routing + ActionController::TestCase

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

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

That’s why there are route tests, right?

> 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