Skip to content

Commit

Permalink
Allow using named routes in ActionController::TestCase before any req…
Browse files Browse the repository at this point in the history
…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
lifo committed Mar 8, 2008
1 parent e91d7ed commit cff3ecc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions 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]
Expand Down
4 changes: 2 additions & 2 deletions actionpack/lib/action_controller/test_case.rb
Expand Up @@ -57,8 +57,8 @@ def prepare_controller_class(new_class)

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
11 changes: 11 additions & 0 deletions actionpack/test/controller/test_test.rb
Expand Up @@ -653,3 +653,14 @@ def test_controller_class_can_be_set_manually_not_just_inferred
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

0 comments on commit cff3ecc

Please sign in to comment.