aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2010-03-30 14:05:42 -0500
committerJoshua Peek <josh@joshpeek.com>2010-03-30 14:05:42 -0500
commitcdf8c35ffdfb39f4de4b030576b1abb06c482668 (patch)
tree16f3973a7f844aa3e55c72c26ba9266c24a6fa72 /actionpack/test/controller
parent17f0c1e9e8a5bfa7c4d2e1632c3b8b91f4678f03 (diff)
downloadrails-cdf8c35ffdfb39f4de4b030576b1abb06c482668.tar.gz
rails-cdf8c35ffdfb39f4de4b030576b1abb06c482668.tar.bz2
rails-cdf8c35ffdfb39f4de4b030576b1abb06c482668.zip
Consistent routing language
Diffstat (limited to 'actionpack/test/controller')
-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
5 files changed, 29 insertions, 29 deletions
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