aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorCarlhuda <carlhuda@engineyard.com>2010-02-25 15:05:10 -0800
committerCarlhuda <carlhuda@engineyard.com>2010-02-25 17:53:01 -0800
commit36fd9efb5e4bfc9ac3acd4189d4dc457dea8102a (patch)
treeee50b242b16d4d4a5c98a2d48f5b0af2d46e5ce0 /actionpack/test
parent9a5be2e5a80ab9e74294f32cfef58fbbcd9b637c (diff)
downloadrails-36fd9efb5e4bfc9ac3acd4189d4dc457dea8102a.tar.gz
rails-36fd9efb5e4bfc9ac3acd4189d4dc457dea8102a.tar.bz2
rails-36fd9efb5e4bfc9ac3acd4189d4dc457dea8102a.zip
Continued effort to deglobalize the router
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/base_test.rb1
-rw-r--r--actionpack/test/controller/routing_test.rb34
2 files changed, 8 insertions, 27 deletions
diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb
index 25006dda76..436ee212c8 100644
--- a/actionpack/test/controller/base_test.rb
+++ b/actionpack/test/controller/base_test.rb
@@ -220,6 +220,7 @@ class EmptyUrlOptionsTest < ActionController::TestCase
def test_named_routes_with_path_without_doing_a_request_first
@controller = EmptyController.new
+ @controller.request = @request
with_routing do |set|
set.draw do |map|
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index f390bbdc89..f2fccfbcfc 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -52,29 +52,11 @@ class UriReservedCharactersRoutingTest < Test::Unit::TestCase
end
class MockController
- attr_accessor :routes
-
- def initialize(routes)
- self.routes = routes
- end
-
def url_for(options)
- only_path = options.delete(:only_path)
-
- port = options.delete(:port) || 80
- port_string = port == 80 ? '' : ":#{port}"
-
- protocol = options.delete(:protocol) || "http"
- host = options.delete(:host) || "test.host"
- anchor = "##{options.delete(:anchor)}" if options.key?(:anchor)
+ options[:protocol] ||= "http"
+ options[:host] ||= "test.host"
- path = routes.generate(options)
-
- only_path ? "#{path}#{anchor}" : "#{protocol}://#{host}#{port_string}#{path}#{anchor}"
- end
-
- def request
- @request ||= ActionController::TestRequest.new
+ super(options)
end
end
@@ -268,9 +250,9 @@ class LegacyRouteSetTests < Test::Unit::TestCase
end
def setup_for_named_route
- klass = Class.new(MockController)
- rs.install_helpers(klass)
- klass.new(rs)
+ inst = MockController.clone.new
+ inst.class.send(:include, rs.named_url_helpers)
+ inst
end
def test_named_route_without_hash
@@ -759,9 +741,7 @@ class RouteSetTest < ActiveSupport::TestCase
map.users '/admin/users', :controller => 'admin/users', :action => 'index'
end
- klass = Class.new(MockController)
- set.install_helpers(klass)
- klass.new(set)
+ MockController.clone.new.tap { |inst| inst.class.send(:include, set.named_url_helpers)}
end
def test_named_route_hash_access_method