Skip to content
This repository
Browse code

Make sure named routes with parameters can be used in tests before a …

…request has been done. [#1208 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
commit b47c76b1dfaaf1d99413b94179077cd58552ba88 1 parent 1b44bbf
Eloy Durán authored October 13, 2008 lifo committed October 13, 2008
3  actionpack/lib/action_controller/test_case.rb
@@ -134,6 +134,9 @@ def setup_controller_request_and_response
134 134
       @controller = self.class.controller_class.new
135 135
       @controller.request = @request = TestRequest.new
136 136
       @response = TestResponse.new
  137
+
  138
+      @controller.params = {}
  139
+      @controller.send(:initialize_current_url)
137 140
     end
138 141
     
139 142
     # Cause the action to be rescued according to the regular rules for rescue_action when the visitor is not local
1  actionpack/test/controller/test_test.rb
@@ -667,6 +667,7 @@ def test_should_be_able_to_use_named_routes_before_a_request_is_done
667 667
     with_routing do |set|
668 668
       set.draw { |map| map.resources :contents }
669 669
       assert_equal 'http://test.host/contents/new', new_content_url
  670
+      assert_equal 'http://test.host/contents/1', content_url(:id => 1)
670 671
     end
671 672
   end
672 673
 end

0 notes on commit b47c76b

Please sign in to comment.
Something went wrong with that request. Please try again.