diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2012-05-10 22:13:04 +0100 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2012-05-10 22:13:04 +0100 |
commit | 66e338aa98d8ccdbeb9ca261886edd1d0c9747b6 (patch) | |
tree | 307e80e9389c8cf4890cc0914301fa84167f131a /actionpack/test/dispatch/routing_test.rb | |
parent | f3aaac46e6e5f4946831466f531a2a03791a3c8a (diff) | |
download | rails-66e338aa98d8ccdbeb9ca261886edd1d0c9747b6.tar.gz rails-66e338aa98d8ccdbeb9ca261886edd1d0c9747b6.tar.bz2 rails-66e338aa98d8ccdbeb9ca261886edd1d0c9747b6.zip |
Don't ignore nil positional arguments for url helpers - fixes #6196.
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 5a6be058ec..6a592acc35 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -2721,3 +2721,37 @@ class TestConstraintsAccessingParameters < ActionDispatch::IntegrationTest assert_equal "bar", @request.params[:bar] end end + +class TestNamedRouteUrlHelpers < ActionDispatch::IntegrationTest + class CategoriesController < ActionController::Base + def show + render :text => "categories#show" + end + end + + class ProductsController < ActionController::Base + def show + render :text => "products#show" + end + end + + Routes = ActionDispatch::Routing::RouteSet.new.tap do |app| + app.draw do + scope :module => "test_named_route_url_helpers" do + get "/categories/:id" => 'categories#show', :as => :category + get "/products/:id" => 'products#show', :as => :product + end + end + end + + def app; Routes end + + include Routes.url_helpers + + test "url helpers do not ignore nil parameters" do + get "/categories/1" + assert_response :success + assert_raises(ActionController::RoutingError) { product_path(nil) } + end +end + |