From 904df818d61b695a5f9508864137d13fffa22d15 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Wed, 3 Oct 2007 05:47:41 +0000 Subject: Move ActionController::Routing.optimise_named_routes to ActionController::Base.optimise_named_routes. Now you can set it in the config. ActionController::Routing::DynamicSegment#interpolation_chunk should call #to_s on all values before calling URI.escape. [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7724 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/resources_test.rb | 4 ++-- actionpack/test/controller/routing_test.rb | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'actionpack/test/controller') diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index d28089da0c..8772e66283 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -33,11 +33,11 @@ class ResourcesTest < Test::Unit::TestCase # The assertions in these tests are incompatible with the hash method # optimisation. This could indicate user level problems def setup - ActionController::Routing.optimise_named_routes = false + ActionController::Base.optimise_named_routes = false end def tear_down - ActionController::Routing.optimise_named_routes = true + ActionController::Base.optimise_named_routes = true end def test_should_arrange_actions diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index ac92af7163..2522b2398b 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -48,7 +48,7 @@ class LegacyRouteSetTests < Test::Unit::TestCase attr_reader :rs def setup # These tests assume optimisation is on, so re-enable it. - ActionController::Routing.optimise_named_routes = true + ActionController::Base.optimise_named_routes = true @rs = ::ActionController::Routing::RouteSet.new @rs.draw {|m| m.connect ':controller/:action/:id' } @@ -852,6 +852,11 @@ class DynamicSegmentTest < Test::Unit::TestCase assert_equal a_value, eval(%("#{segment.interpolation_chunk}")) end + def test_interpolation_chunk_should_accept_nil + a_value = nil + assert_equal '', eval(%("#{segment.interpolation_chunk('a_value')}")) + end + def test_value_regexp_should_be_nil_without_regexp assert_equal nil, segment.value_regexp end -- cgit v1.2.3