Skip to content
This repository
Browse code

Allow using named routes in ActionController::TestCase before any req…

…uest has been made. Closes #11273 [alloy]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8992 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit cff3ecc2aef098fa1a0158f3d0fc01de37774e2d 1 parent e91d7ed
Pratik authored March 08, 2008
2  actionpack/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *SVN*
2 2
 
  3
+* Allow using named routes in ActionController::TestCase before any request has been made. Closes #11273 [alloy]
  4
+
3 5
 * Fixed that sweepers defined by cache_sweeper will be added regardless of the perform_caching setting. Instead, control whether the sweeper should be run with the perform_caching setting. This makes testing easier when you want to turn perform_caching on/off [DHH]
4 6
 
5 7
 * Make MimeResponds::Responder#any work without explicit types. Closes #11140 [jaw6]
4  actionpack/lib/action_controller/test_case.rb
@@ -57,8 +57,8 @@ def prepare_controller_class(new_class)
57 57
 
58 58
     def setup_controller_request_and_response
59 59
       @controller = self.class.controller_class.new
60  
-      @request    = TestRequest.new
61  
-      @response   = TestResponse.new
  60
+      @controller.request = @request = TestRequest.new
  61
+      @response = TestResponse.new
62 62
     end
63 63
  end
64 64
 end
11  actionpack/test/controller/test_test.rb
@@ -653,3 +653,14 @@ def test_controller_class_can_be_set_manually_not_just_inferred
653 653
     assert_equal ContentController, self.class.controller_class
654 654
   end
655 655
 end
  656
+
  657
+class NamedRoutesControllerTest < ActionController::TestCase
  658
+  tests ContentController
  659
+  
  660
+  def test_should_be_able_to_use_named_routes_before_a_request_is_done
  661
+    with_routing do |set|
  662
+      set.draw { |map| map.resources :contents }
  663
+      assert_equal 'http://test.host/contents/new', new_content_url
  664
+    end
  665
+  end
  666
+end

0 notes on commit cff3ecc

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