aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/base_test.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-08-16 21:14:26 -0500
committerJoshua Peek <josh@joshpeek.com>2009-08-16 21:14:26 -0500
commit24ad9ae3d228acdf9aa31cf28bfe6dfb0139c247 (patch)
tree8328606506d2db378a35905a0953b59b0e84cfdf /actionpack/test/controller/base_test.rb
parentccf28d2499d1b4e2aba41291eb800e0e02120923 (diff)
downloadrails-24ad9ae3d228acdf9aa31cf28bfe6dfb0139c247.tar.gz
rails-24ad9ae3d228acdf9aa31cf28bfe6dfb0139c247.tar.bz2
rails-24ad9ae3d228acdf9aa31cf28bfe6dfb0139c247.zip
Cleanup route reloading in tests. Prefer with_routing over using ActionController::Routing::Routes directly
Diffstat (limited to 'actionpack/test/controller/base_test.rb')
-rw-r--r--actionpack/test/controller/base_test.rb34
1 files changed, 17 insertions, 17 deletions
diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb
index 8877057070..b97ceb4594 100644
--- a/actionpack/test/controller/base_test.rb
+++ b/actionpack/test/controller/base_test.rb
@@ -177,17 +177,17 @@ class DefaultUrlOptionsTest < ActionController::TestCase
end
def test_default_url_options_are_used_if_set
- ActionController::Routing::Routes.draw do |map|
- map.default_url_options 'default_url_options', :controller => 'default_url_options'
- map.connect ':controller/:action/:id'
- end
+ with_routing do |set|
+ set.draw do |map|
+ map.default_url_options 'default_url_options', :controller => 'default_url_options'
+ map.connect ':controller/:action/:id'
+ end
- get :default_url_options_action # Make a dummy request so that the controller is initialized properly.
+ get :default_url_options_action # Make a dummy request so that the controller is initialized properly.
- assert_equal 'http://www.override.com/default_url_options/new?bacon=chunky', @controller.url_for(:controller => 'default_url_options')
- assert_equal 'http://www.override.com/default_url_options?bacon=chunky', @controller.send(:default_url_options_url)
- ensure
- ActionController::Routing::Routes.load!
+ assert_equal 'http://www.override.com/default_url_options/new?bacon=chunky', @controller.url_for(:controller => 'default_url_options')
+ assert_equal 'http://www.override.com/default_url_options?bacon=chunky', @controller.send(:default_url_options_url)
+ end
end
end
@@ -206,15 +206,15 @@ class EmptyUrlOptionsTest < ActionController::TestCase
end
end
-class EnsureNamedRoutesWorksTicket22BugTest < Test::Unit::TestCase
+class EnsureNamedRoutesWorksTicket22BugTest < ActionController::TestCase
def test_named_routes_still_work
- ActionController::Routing::Routes.draw do |map|
- map.resources :things
- end
- EmptyController.send :include, ActionController::UrlWriter
+ with_routing do |set|
+ set.draw do |map|
+ map.resources :things
+ end
+ EmptyController.send :include, ActionController::UrlWriter
- assert_equal '/things', EmptyController.new.send(:things_path)
- ensure
- ActionController::Routing::Routes.load!
+ assert_equal '/things', EmptyController.new.send(:things_path)
+ end
end
end