aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller')
-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