aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-03-08 12:56:41 +0000
committerPratik Naik <pratiknaik@gmail.com>2008-03-08 12:56:41 +0000
commitcff3ecc2aef098fa1a0158f3d0fc01de37774e2d (patch)
tree889615b2577757750ea86e7e5d22afb9e6b87bd1
parente91d7ed53ded1d0b6ac7f52df6543f46ec4b6d97 (diff)
downloadrails-cff3ecc2aef098fa1a0158f3d0fc01de37774e2d.tar.gz
rails-cff3ecc2aef098fa1a0158f3d0fc01de37774e2d.tar.bz2
rails-cff3ecc2aef098fa1a0158f3d0fc01de37774e2d.zip
Allow using named routes in ActionController::TestCase before any request has been made. Closes #11273 [alloy]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8992 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/test_case.rb4
-rw-r--r--actionpack/test/controller/test_test.rb11
3 files changed, 15 insertions, 2 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 70e309489c..43fb5556f9 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Allow using named routes in ActionController::TestCase before any request has been made. Closes #11273 [alloy]
+
* 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]
* Make MimeResponds::Responder#any work without explicit types. Closes #11140 [jaw6]
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index dc022cbde3..06b12a524f 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -57,8 +57,8 @@ module ActionController
def setup_controller_request_and_response
@controller = self.class.controller_class.new
- @request = TestRequest.new
- @response = TestResponse.new
+ @controller.request = @request = TestRequest.new
+ @response = TestResponse.new
end
end
end
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb
index 7755fb7405..04cc2a20d8 100644
--- a/actionpack/test/controller/test_test.rb
+++ b/actionpack/test/controller/test_test.rb
@@ -653,3 +653,14 @@ class CrazyNameTest < ActionController::TestCase
assert_equal ContentController, self.class.controller_class
end
end
+
+class NamedRoutesControllerTest < ActionController::TestCase
+ tests ContentController
+
+ def test_should_be_able_to_use_named_routes_before_a_request_is_done
+ with_routing do |set|
+ set.draw { |map| map.resources :contents }
+ assert_equal 'http://test.host/contents/new', new_content_url
+ end
+ end
+end