aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_controller/railties/url_helpers.rb6
-rw-r--r--actionpack/lib/action_controller/test_case.rb10
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/routing.rb20
-rw-r--r--actionpack/test/abstract_unit.rb15
-rw-r--r--actionpack/test/activerecord/polymorphic_routes_test.rb164
-rw-r--r--actionpack/test/controller/caching_test.rb6
-rw-r--r--actionpack/test/controller/resources_test.rb14
-rw-r--r--actionpack/test/controller/test_test.rb8
-rw-r--r--actionpack/test/controller/url_rewriter_test.rb28
-rw-r--r--actionpack/test/controller/webservice_test.rb2
-rw-r--r--actionpack/test/template/test_case_test.rb2
11 files changed, 137 insertions, 138 deletions
diff --git a/actionpack/lib/action_controller/railties/url_helpers.rb b/actionpack/lib/action_controller/railties/url_helpers.rb
index 5f95e1c621..9df5665542 100644
--- a/actionpack/lib/action_controller/railties/url_helpers.rb
+++ b/actionpack/lib/action_controller/railties/url_helpers.rb
@@ -1,14 +1,14 @@
module ActionController
module Railties
module UrlHelpers
- def self.with(router)
+ def self.with(routes)
Module.new do
define_method(:inherited) do |klass|
super(klass)
- klass.send(:include, router.url_helpers)
+ klass.send(:include, routes.url_helpers)
end
end
end
end
end
-end \ No newline at end of file
+end
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 306db4a431..2d4cf2fafb 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -118,9 +118,9 @@ module ActionController
end
end
- def assign_parameters(router, controller_path, action, parameters = {})
+ def assign_parameters(routes, controller_path, action, parameters = {})
parameters = parameters.symbolize_keys.merge(:controller => controller_path, :action => action)
- extra_keys = router.extra_keys(parameters)
+ extra_keys = routes.extra_keys(parameters)
non_path_parameters = get? ? query_parameters : request_parameters
parameters.each do |key, value|
if value.is_a? Fixnum
@@ -322,7 +322,7 @@ module ActionController
def process(action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
# Sanity check for required instance variables so we can give an
# understandable error message.
- %w(@router @controller @request @response).each do |iv_name|
+ %w(@routes @controller @request @response).each do |iv_name|
if !(instance_variable_names.include?(iv_name) || instance_variable_names.include?(iv_name.to_sym)) || instance_variable_get(iv_name).nil?
raise "#{iv_name} is nil: make sure you set it in your test's setup method."
end
@@ -338,7 +338,7 @@ module ActionController
@request.env['REQUEST_METHOD'] = http_method
parameters ||= {}
- @request.assign_parameters(@router, @controller.class.name.underscore.sub(/_controller$/, ''), action.to_s, parameters)
+ @request.assign_parameters(@routes, @controller.class.name.underscore.sub(/_controller$/, ''), action.to_s, parameters)
@request.session = ActionController::TestSession.new(session) unless session.nil?
@request.session["flash"] = @request.flash.update(flash || {})
@@ -447,7 +447,7 @@ module ActionController
:relative_url_root => nil,
:_path_segments => @request.symbolized_path_parameters)
- url, query_string = @router.url_for(options).split("?", 2)
+ url, query_string = @routes.url_for(options).split("?", 2)
@request.env["SCRIPT_NAME"] = @controller.config.relative_url_root
@request.env["PATH_INFO"] = url
diff --git a/actionpack/lib/action_dispatch/testing/assertions/routing.rb b/actionpack/lib/action_dispatch/testing/assertions/routing.rb
index 08f3d90e18..b7e9b0c95a 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/routing.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/routing.rb
@@ -80,7 +80,7 @@ module ActionDispatch
expected_path = "/#{expected_path}" unless expected_path[0] == ?/
# Load routes.rb if it hasn't been loaded.
- generated_path, extra_keys = @router.generate_extras(options, defaults)
+ generated_path, extra_keys = @routes.generate_extras(options, defaults)
found_extras = options.reject {|k, v| ! extra_keys.include? k}
msg = build_message(message, "found extras <?>, not <?>", found_extras, extras)
@@ -125,7 +125,7 @@ module ActionDispatch
end
# A helper to make it easier to test different route configurations.
- # This method temporarily replaces @router
+ # This method temporarily replaces @routes
# with a new RouteSet instance.
#
# The new instance is yielded to the passed block. Typically the block
@@ -142,9 +142,9 @@ module ActionDispatch
# end
#
def with_routing
- old_routes, @router = @router, ActionDispatch::Routing::RouteSet.new
+ old_routes, @routes = @routes, ActionDispatch::Routing::RouteSet.new
old_controller, @controller = @controller, @controller.clone if @controller
- _router = @router
+ _routes = @routes
# Unfortunately, there is currently an abstraction leak between AC::Base
# and AV::Base which requires having the URL helpers in both AC and AV.
@@ -153,14 +153,14 @@ module ActionDispatch
#
# TODO: Make this unnecessary
if @controller
- @controller.singleton_class.send(:include, _router.url_helpers)
+ @controller.singleton_class.send(:include, _routes.url_helpers)
@controller.view_context_class = Class.new(@controller.view_context_class) do
- include _router.url_helpers
+ include _routes.url_helpers
end
end
- yield @router
+ yield @routes
ensure
- @router = old_routes
+ @routes = old_routes
if @controller
@controller = old_controller
end
@@ -168,7 +168,7 @@ module ActionDispatch
# ROUTES TODO: These assertions should really work in an integration context
def method_missing(selector, *args, &block)
- if @controller && @router && @router.named_routes.helpers.include?(selector)
+ if @controller && @routes && @routes.named_routes.helpers.include?(selector)
@controller.send(selector, *args, &block)
else
super
@@ -185,7 +185,7 @@ module ActionDispatch
request.env["REQUEST_METHOD"] = request_method.to_s.upcase if request_method
request.path = path
- params = @router.recognize_path(path, { :method => request.method })
+ params = @routes.recognize_path(path, { :method => request.method })
request.path_parameters = params.with_indifferent_access
request
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index 5b2ff3e871..143491a640 100644
--- a/actionpack/test/abstract_unit.rb
+++ b/actionpack/test/abstract_unit.rb
@@ -95,7 +95,7 @@ module ActiveSupport
map.connect ':controller/:action/:id'
end
- ActionController::IntegrationTest.app.router.draw do |map|
+ ActionController::IntegrationTest.app.routes.draw do |map|
# FIXME: match ':controller(/:action(/:id))'
map.connect ':controller/:action/:id'
end
@@ -104,12 +104,11 @@ module ActiveSupport
end
class RoutedRackApp
- attr_reader :router
- alias routes router
+ attr_reader :routes
- def initialize(router, &blk)
- @router = router
- @stack = ActionDispatch::MiddlewareStack.new(&blk).build(@router)
+ def initialize(routes, &blk)
+ @routes = routes
+ @stack = ActionDispatch::MiddlewareStack.new(&blk).build(@routes)
end
def call(env)
@@ -234,7 +233,7 @@ module ActionView
# Must repeat the setup because AV::TestCase is a duplication
# of AC::TestCase
setup do
- @router = SharedTestRoutes
+ @routes = SharedTestRoutes
end
end
end
@@ -250,7 +249,7 @@ module ActionController
include ActionDispatch::TestProcess
setup do
- @router = SharedTestRoutes
+ @routes = SharedTestRoutes
end
end
end
diff --git a/actionpack/test/activerecord/polymorphic_routes_test.rb b/actionpack/test/activerecord/polymorphic_routes_test.rb
index 5643ad5ad6..9f5e8ec657 100644
--- a/actionpack/test/activerecord/polymorphic_routes_test.rb
+++ b/actionpack/test/activerecord/polymorphic_routes_test.rb
@@ -40,12 +40,12 @@ class PolymorphicRoutesTest < ActionController::TestCase
end
def test_with_record
- with_test_routes do
+ with_test_routes do
@project.save
assert_equal "http://example.com/projects/#{@project.id}", polymorphic_url(@project)
end
end
-
+
def test_with_class
with_test_routes do
assert_equal "http://example.com/projects", polymorphic_url(@project.class)
@@ -53,67 +53,67 @@ class PolymorphicRoutesTest < ActionController::TestCase
end
def test_with_new_record
- with_test_routes do
+ with_test_routes do
assert_equal "http://example.com/projects", polymorphic_url(@project)
end
end
def test_with_destroyed_record
- with_test_routes do
+ with_test_routes do
@project.destroy
assert_equal "http://example.com/projects", polymorphic_url(@project)
end
end
def test_with_record_and_action
- with_test_routes do
+ with_test_routes do
assert_equal "http://example.com/projects/new", polymorphic_url(@project, :action => 'new')
end
end
def test_url_helper_prefixed_with_new
- with_test_routes do
+ with_test_routes do
assert_equal "http://example.com/projects/new", new_polymorphic_url(@project)
end
end
def test_url_helper_prefixed_with_edit
- with_test_routes do
+ with_test_routes do
@project.save
assert_equal "http://example.com/projects/#{@project.id}/edit", edit_polymorphic_url(@project)
end
end
-
+
def test_url_helper_prefixed_with_edit_with_url_options
- with_test_routes do
+ with_test_routes do
@project.save
assert_equal "http://example.com/projects/#{@project.id}/edit?param1=10", edit_polymorphic_url(@project, :param1 => '10')
end
end
-
+
def test_url_helper_with_url_options
- with_test_routes do
+ with_test_routes do
@project.save
assert_equal "http://example.com/projects/#{@project.id}?param1=10", polymorphic_url(@project, :param1 => '10')
end
end
def test_format_option
- with_test_routes do
+ with_test_routes do
@project.save
assert_equal "http://example.com/projects/#{@project.id}.pdf", polymorphic_url(@project, :format => :pdf)
end
end
-
+
def test_format_option_with_url_options
- with_test_routes do
+ with_test_routes do
@project.save
assert_equal "http://example.com/projects/#{@project.id}.pdf?param1=10", polymorphic_url(@project, :format => :pdf, :param1 => '10')
end
end
-
+
def test_id_and_format_option
- with_test_routes do
+ with_test_routes do
@project.save
assert_equal "http://example.com/projects/#{@project.id}.pdf", polymorphic_url(:id => @project, :format => :pdf)
end
@@ -126,14 +126,14 @@ class PolymorphicRoutesTest < ActionController::TestCase
assert_equal "http://example.com/projects/#{@project.id}/tasks/#{@task.id}", polymorphic_url([@project, @task])
end
end
-
+
def test_with_nested_unsaved
with_test_routes do
@project.save
assert_equal "http://example.com/projects/#{@project.id}/tasks", polymorphic_url([@project, @task])
end
end
-
+
def test_with_nested_destroyed
with_test_routes do
@project.save
@@ -141,63 +141,63 @@ class PolymorphicRoutesTest < ActionController::TestCase
assert_equal "http://example.com/projects/#{@project.id}/tasks", polymorphic_url([@project, @task])
end
end
-
+
def test_with_nested_class
with_test_routes do
@project.save
assert_equal "http://example.com/projects/#{@project.id}/tasks", polymorphic_url([@project, @task.class])
end
end
-
+
def test_class_with_array_and_namespace
- with_admin_test_routes do
+ with_admin_test_routes do
assert_equal "http://example.com/admin/projects", polymorphic_url([:admin, @project.class])
end
end
-
+
def test_new_with_array_and_namespace
- with_admin_test_routes do
+ with_admin_test_routes do
assert_equal "http://example.com/admin/projects/new", polymorphic_url([:admin, @project], :action => 'new')
end
end
-
+
def test_unsaved_with_array_and_namespace
- with_admin_test_routes do
+ with_admin_test_routes do
assert_equal "http://example.com/admin/projects", polymorphic_url([:admin, @project])
end
end
-
+
def test_nested_unsaved_with_array_and_namespace
- with_admin_test_routes do
+ with_admin_test_routes do
@project.save
assert_equal "http://example.com/admin/projects/#{@project.id}/tasks", polymorphic_url([:admin, @project, @task])
end
end
-
+
def test_nested_with_array_and_namespace
- with_admin_test_routes do
+ with_admin_test_routes do
@project.save
@task.save
assert_equal "http://example.com/admin/projects/#{@project.id}/tasks/#{@task.id}", polymorphic_url([:admin, @project, @task])
end
end
-
+
def test_ordering_of_nesting_and_namespace
- with_admin_and_site_test_routes do
+ with_admin_and_site_test_routes do
@project.save
@task.save
@step.save
assert_equal "http://example.com/admin/projects/#{@project.id}/site/tasks/#{@task.id}/steps/#{@step.id}", polymorphic_url([:admin, @project, :site, @task, @step])
end
end
-
+
def test_nesting_with_array_ending_in_singleton_resource
with_test_routes do
@project.save
assert_equal "http://example.com/projects/#{@project.id}/bid", polymorphic_url([@project, :bid])
end
end
-
+
def test_nesting_with_array_containing_singleton_resource
with_test_routes do
@project.save
@@ -205,7 +205,7 @@ class PolymorphicRoutesTest < ActionController::TestCase
assert_equal "http://example.com/projects/#{@project.id}/bid/tasks/#{@task.id}", polymorphic_url([@project, :bid, @task])
end
end
-
+
def test_nesting_with_array_containing_singleton_resource_and_format
with_test_routes do
@project.save
@@ -213,7 +213,7 @@ class PolymorphicRoutesTest < ActionController::TestCase
assert_equal "http://example.com/projects/#{@project.id}/bid/tasks/#{@task.id}.pdf", polymorphic_url([@project, :bid, @task], :format => :pdf)
end
end
-
+
def test_nesting_with_array_containing_namespace_and_singleton_resource
with_admin_test_routes do
@project.save
@@ -221,47 +221,47 @@ class PolymorphicRoutesTest < ActionController::TestCase
assert_equal "http://example.com/admin/projects/#{@project.id}/bid/tasks/#{@task.id}", polymorphic_url([:admin, @project, :bid, @task])
end
end
-
+
def test_nesting_with_array_containing_nil
with_test_routes do
@project.save
assert_equal "http://example.com/projects/#{@project.id}/bid", polymorphic_url([@project, nil, :bid])
end
end
-
+
def test_with_array_containing_single_object
- with_test_routes do
+ with_test_routes do
@project.save
assert_equal "http://example.com/projects/#{@project.id}", polymorphic_url([nil, @project])
end
end
-
+
def test_with_array_containing_single_name
- with_test_routes do
+ with_test_routes do
@project.save
assert_equal "http://example.com/projects", polymorphic_url([:projects])
end
end
-
+
def test_with_array_containing_symbols
with_test_routes do
assert_equal "http://example.com/series/new", polymorphic_url([:new, :series])
end
end
-
+
def test_with_hash
- with_test_routes do
+ with_test_routes do
@project.save
assert_equal "http://example.com/projects/#{@project.id}", polymorphic_url(:id => @project)
end
end
-
+
def test_polymorphic_path_accepts_options
- with_test_routes do
+ with_test_routes do
assert_equal "/projects/new", polymorphic_path(@project, :action => 'new')
end
end
-
+
def test_polymorphic_path_does_not_modify_arguments
with_admin_test_routes do
@project.save
@@ -275,108 +275,108 @@ class PolymorphicRoutesTest < ActionController::TestCase
assert_equal original_args, [object_array, options]
end
end
-
+
# Tests for names where .plural.singular doesn't round-trip
def test_with_irregular_plural_record
- with_test_routes do
+ with_test_routes do
@tax.save
assert_equal "http://example.com/taxes/#{@tax.id}", polymorphic_url(@tax)
end
end
-
+
def test_with_irregular_plural_class
- with_test_routes do
+ with_test_routes do
assert_equal "http://example.com/taxes", polymorphic_url(@tax.class)
end
end
-
+
def test_with_irregular_plural_new_record
- with_test_routes do
+ with_test_routes do
assert_equal "http://example.com/taxes", polymorphic_url(@tax)
end
end
def test_with_irregular_plural_destroyed_record
with_test_routes do
- @tax.destroy
+ @tax.destroy
assert_equal "http://example.com/taxes", polymorphic_url(@tax)
end
end
-
+
def test_with_irregular_plural_record_and_action
- with_test_routes do
+ with_test_routes do
assert_equal "http://example.com/taxes/new", polymorphic_url(@tax, :action => 'new')
end
end
-
+
def test_irregular_plural_url_helper_prefixed_with_new
- with_test_routes do
+ with_test_routes do
assert_equal "http://example.com/taxes/new", new_polymorphic_url(@tax)
end
end
-
+
def test_irregular_plural_url_helper_prefixed_with_edit
- with_test_routes do
+ with_test_routes do
@tax.save
assert_equal "http://example.com/taxes/#{@tax.id}/edit", edit_polymorphic_url(@tax)
end
end
-
+
def test_with_nested_irregular_plurals
- with_test_routes do
+ with_test_routes do
@tax.save
@fax.save
assert_equal "http://example.com/taxes/#{@tax.id}/faxes/#{@fax.id}", polymorphic_url([@tax, @fax])
end
end
-
+
def test_with_nested_unsaved_irregular_plurals
- with_test_routes do
+ with_test_routes do
@tax.save
assert_equal "http://example.com/taxes/#{@tax.id}/faxes", polymorphic_url([@tax, @fax])
end
end
-
+
def test_new_with_irregular_plural_array_and_namespace
- with_admin_test_routes do
+ with_admin_test_routes do
assert_equal "http://example.com/admin/taxes/new", polymorphic_url([:admin, @tax], :action => 'new')
end
end
-
+
def test_class_with_irregular_plural_array_and_namespace
- with_admin_test_routes do
+ with_admin_test_routes do
assert_equal "http://example.com/admin/taxes", polymorphic_url([:admin, @tax.class])
end
end
-
+
def test_unsaved_with_irregular_plural_array_and_namespace
- with_admin_test_routes do
+ with_admin_test_routes do
assert_equal "http://example.com/admin/taxes", polymorphic_url([:admin, @tax])
end
end
-
+
def test_nesting_with_irregular_plurals_and_array_ending_in_singleton_resource
- with_test_routes do
+ with_test_routes do
@tax.save
assert_equal "http://example.com/taxes/#{@tax.id}/bid", polymorphic_url([@tax, :bid])
end
end
-
+
def test_with_array_containing_single_irregular_plural_object
- with_test_routes do
+ with_test_routes do
@tax.save
assert_equal "http://example.com/taxes/#{@tax.id}", polymorphic_url([nil, @tax])
end
end
-
+
def test_with_array_containing_single_name_irregular_plural
- with_test_routes do
+ with_test_routes do
@tax.save
assert_equal "http://example.com/taxes", polymorphic_url([:taxes])
end
end
-
- # Tests for uncountable names
+
+ # Tests for uncountable names
def test_uncountable_resource
with_test_routes do
@series.save
@@ -400,11 +400,11 @@ class PolymorphicRoutesTest < ActionController::TestCase
map.resources :series
end
- self.class.send(:include, @router.url_helpers)
+ self.class.send(:include, @routes.url_helpers)
yield
end
end
-
+
def with_admin_test_routes(options = {})
with_routing do |set|
set.draw do |map|
@@ -422,11 +422,11 @@ class PolymorphicRoutesTest < ActionController::TestCase
end
end
- self.class.send(:include, @router.url_helpers)
+ self.class.send(:include, @routes.url_helpers)
yield
end
end
-
+
def with_admin_and_site_test_routes(options = {})
with_routing do |set|
set.draw do |map|
@@ -441,7 +441,7 @@ class PolymorphicRoutesTest < ActionController::TestCase
end
end
- self.class.send(:include, @router.url_helpers)
+ self.class.send(:include, @routes.url_helpers)
yield
end
end
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb
index f0ad652d50..217260fdcd 100644
--- a/actionpack/test/controller/caching_test.rb
+++ b/actionpack/test/controller/caching_test.rb
@@ -81,9 +81,9 @@ class PageCachingTest < ActionController::TestCase
match '/', :to => 'posts#index', :as => :main
end
@params[:format] = 'rss'
- assert_equal '/posts.rss', @router.url_for(@params)
+ assert_equal '/posts.rss', @routes.url_for(@params)
@params[:format] = nil
- assert_equal '/', @router.url_for(@params)
+ assert_equal '/', @routes.url_for(@params)
end
end
@@ -518,7 +518,7 @@ class ActionCacheTest < ActionController::TestCase
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@controller = ActionCachingTestController.new
- @controller.singleton_class.send(:include, @router.url_helpers)
+ @controller.singleton_class.send(:include, @routes.url_helpers)
@request.host = 'hostname.com'
end
diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb
index 17c645c04c..a9d1c55c05 100644
--- a/actionpack/test/controller/resources_test.rb
+++ b/actionpack/test/controller/resources_test.rb
@@ -126,7 +126,7 @@ class ResourcesTest < ActionController::TestCase
def test_with_custom_conditions
with_restful_routing :messages, :conditions => { :subdomain => 'app' } do
- assert @router.recognize_path("/messages", :method => :get, :subdomain => 'app')
+ assert @routes.recognize_path("/messages", :method => :get, :subdomain => 'app')
end
end
@@ -395,7 +395,7 @@ class ResourcesTest < ActionController::TestCase
assert_restful_routes_for :messages do |options|
assert_recognizes(options.merge(:action => "new"), :path => "/messages/new", :method => :get)
assert_raise(ActionController::RoutingError) do
- @router.recognize_path("/messages/new", :method => :post)
+ @routes.recognize_path("/messages/new", :method => :post)
end
end
end
@@ -505,7 +505,7 @@ class ResourcesTest < ActionController::TestCase
def test_restful_routes_dont_generate_duplicates
with_restful_routing :messages do
- routes = @router.routes
+ routes = @routes.routes
routes.each do |route|
routes.each do |r|
next if route === r # skip the comparison instance
@@ -1169,8 +1169,8 @@ class ResourcesTest < ActionController::TestCase
options[:shallow_options] = options[:options]
end
- new_action = @router.resources_path_names[:new] || "new"
- edit_action = @router.resources_path_names[:edit] || "edit"
+ new_action = @routes.resources_path_names[:new] || "new"
+ edit_action = @routes.resources_path_names[:edit] || "edit"
if options[:path_names]
new_action = options[:path_names][:new] if options[:path_names][:new]
@@ -1237,7 +1237,7 @@ class ResourcesTest < ActionController::TestCase
end
@controller = "#{options[:options][:controller].camelize}Controller".constantize.new
- @controller.singleton_class.send(:include, @router.url_helpers)
+ @controller.singleton_class.send(:include, @routes.url_helpers)
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
get :index, options[:options]
@@ -1307,7 +1307,7 @@ class ResourcesTest < ActionController::TestCase
def assert_singleton_named_routes_for(singleton_name, options = {})
(options[:options] ||= {})[:controller] ||= singleton_name.to_s.pluralize
@controller = "#{options[:options][:controller].camelize}Controller".constantize.new
- @controller.singleton_class.send(:include, @router.url_helpers)
+ @controller.singleton_class.send(:include, @routes.url_helpers)
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
get :show, options[:options]
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb
index f6ba275849..8910454b8b 100644
--- a/actionpack/test/controller/test_test.rb
+++ b/actionpack/test/controller/test_test.rb
@@ -478,8 +478,8 @@ XML
end
def test_with_routing_places_routes_back
- assert @router
- routes_id = @router.object_id
+ assert @routes
+ routes_id = @routes.object_id
begin
with_routing { raise 'fail' }
@@ -487,8 +487,8 @@ XML
rescue RuntimeError
end
- assert @router
- assert_equal routes_id, @router.object_id
+ assert @routes
+ assert_equal routes_id, @routes.object_id
end
def test_remote_addr
diff --git a/actionpack/test/controller/url_rewriter_test.rb b/actionpack/test/controller/url_rewriter_test.rb
index 7b46a48a1d..a8d7b75372 100644
--- a/actionpack/test/controller/url_rewriter_test.rb
+++ b/actionpack/test/controller/url_rewriter_test.rb
@@ -10,8 +10,8 @@ class UrlRewriterTests < ActionController::TestCase
}
end
- def rewrite(router, options)
- router.url_for(@options.merge(options))
+ def rewrite(routes, options)
+ routes.url_for(@options.merge(options))
end
end
@@ -23,63 +23,63 @@ class UrlRewriterTests < ActionController::TestCase
def test_port
assert_equal('http://test.host:1271/c/a/i',
- @rewriter.rewrite(@router, :controller => 'c', :action => 'a', :id => 'i', :port => 1271)
+ @rewriter.rewrite(@routes, :controller => 'c', :action => 'a', :id => 'i', :port => 1271)
)
end
def test_protocol_with_and_without_separator
assert_equal('https://test.host/c/a/i',
- @rewriter.rewrite(@router, :protocol => 'https', :controller => 'c', :action => 'a', :id => 'i')
+ @rewriter.rewrite(@routes, :protocol => 'https', :controller => 'c', :action => 'a', :id => 'i')
)
assert_equal('https://test.host/c/a/i',
- @rewriter.rewrite(@router, :protocol => 'https://', :controller => 'c', :action => 'a', :id => 'i')
+ @rewriter.rewrite(@routes, :protocol => 'https://', :controller => 'c', :action => 'a', :id => 'i')
)
end
def test_user_name_and_password
assert_equal(
'http://david:secret@test.host/c/a/i',
- @rewriter.rewrite(@router, :user => "david", :password => "secret", :controller => 'c', :action => 'a', :id => 'i')
+ @rewriter.rewrite(@routes, :user => "david", :password => "secret", :controller => 'c', :action => 'a', :id => 'i')
)
end
def test_user_name_and_password_with_escape_codes
assert_equal(
'http://openid.aol.com%2Fnextangler:one+two%3F@test.host/c/a/i',
- @rewriter.rewrite(@router, :user => "openid.aol.com/nextangler", :password => "one two?", :controller => 'c', :action => 'a', :id => 'i')
+ @rewriter.rewrite(@routes, :user => "openid.aol.com/nextangler", :password => "one two?", :controller => 'c', :action => 'a', :id => 'i')
)
end
def test_anchor
assert_equal(
'http://test.host/c/a/i#anchor',
- @rewriter.rewrite(@router, :controller => 'c', :action => 'a', :id => 'i', :anchor => 'anchor')
+ @rewriter.rewrite(@routes, :controller => 'c', :action => 'a', :id => 'i', :anchor => 'anchor')
)
end
def test_anchor_should_call_to_param
assert_equal(
'http://test.host/c/a/i#anchor',
- @rewriter.rewrite(@router, :controller => 'c', :action => 'a', :id => 'i', :anchor => Struct.new(:to_param).new('anchor'))
+ @rewriter.rewrite(@routes, :controller => 'c', :action => 'a', :id => 'i', :anchor => Struct.new(:to_param).new('anchor'))
)
end
def test_anchor_should_be_cgi_escaped
assert_equal(
'http://test.host/c/a/i#anc%2Fhor',
- @rewriter.rewrite(@router, :controller => 'c', :action => 'a', :id => 'i', :anchor => Struct.new(:to_param).new('anc/hor'))
+ @rewriter.rewrite(@routes, :controller => 'c', :action => 'a', :id => 'i', :anchor => Struct.new(:to_param).new('anc/hor'))
)
end
def test_trailing_slash
options = {:controller => 'foo', :action => 'bar', :id => '3', :only_path => true}
- assert_equal '/foo/bar/3', @rewriter.rewrite(@router, options)
- assert_equal '/foo/bar/3?query=string', @rewriter.rewrite(@router, options.merge({:query => 'string'}))
+ assert_equal '/foo/bar/3', @rewriter.rewrite(@routes, options)
+ assert_equal '/foo/bar/3?query=string', @rewriter.rewrite(@routes, options.merge({:query => 'string'}))
options.update({:trailing_slash => true})
- assert_equal '/foo/bar/3/', @rewriter.rewrite(@router, options)
+ assert_equal '/foo/bar/3/', @rewriter.rewrite(@routes, options)
options.update({:query => 'string'})
- assert_equal '/foo/bar/3/?query=string', @rewriter.rewrite(@router, options)
+ assert_equal '/foo/bar/3/?query=string', @rewriter.rewrite(@routes, options)
end
end
diff --git a/actionpack/test/controller/webservice_test.rb b/actionpack/test/controller/webservice_test.rb
index 05545395fb..5942950b15 100644
--- a/actionpack/test/controller/webservice_test.rb
+++ b/actionpack/test/controller/webservice_test.rb
@@ -245,7 +245,7 @@ class WebServiceTest < ActionController::IntegrationTest
private
def with_params_parsers(parsers = {})
old_session = @integration_session
- @app = ActionDispatch::ParamsParser.new(app.router, parsers)
+ @app = ActionDispatch::ParamsParser.new(app.routes, parsers)
reset!
yield
ensure
diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb
index 195a6ea3ae..c1a38a25de 100644
--- a/actionpack/test/template/test_case_test.rb
+++ b/actionpack/test/template/test_case_test.rb
@@ -114,7 +114,7 @@ module ActionView
end
test "is able to use routes" do
- controller.request.assign_parameters(@router, 'foo', 'index')
+ controller.request.assign_parameters(@routes, 'foo', 'index')
assert_equal '/foo', url_for
assert_equal '/bar', url_for(:controller => 'bar')
end