From 3ac00aed9550b296d8753cb9311cf170d56b3b84 Mon Sep 17 00:00:00 2001 From: Eloy Duran Date: Mon, 13 Oct 2008 16:08:41 +0200 Subject: [PATCH] Make sure named routes with parameters can be used in tests before a request has been done. --- actionpack/lib/action_controller/test_case.rb | 3 +++ actionpack/test/controller/test_test.rb | 1 + 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 6a39039..4fc60f0 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -134,6 +134,9 @@ module ActionController @controller = self.class.controller_class.new @controller.request = @request = TestRequest.new @response = TestResponse.new + + @controller.params = {} + @controller.send(:initialize_current_url) end # Cause the action to be rescued according to the regular rules for rescue_action when the visitor is not local diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 9eff34a..a234288 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -667,6 +667,7 @@ class NamedRoutesControllerTest < ActionController::TestCase with_routing do |set| set.draw { |map| map.resources :contents } assert_equal 'http://test.host/contents/new', new_content_url + assert_equal 'http://test.host/contents/1', content_url(:id => 1) end end end -- 1.5.6.4