aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-01-23 10:18:36 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-01-23 10:18:36 -0800
commitbce3b5cb72e61d855cdc924038a09b258bfcdf0c (patch)
treed7cfac2102519b601e08fc84682e4910be7bedbf /actionpack
parent5e8102179aa6403f56e757f22451f784ea43aebd (diff)
downloadrails-bce3b5cb72e61d855cdc924038a09b258bfcdf0c.tar.gz
rails-bce3b5cb72e61d855cdc924038a09b258bfcdf0c.tar.bz2
rails-bce3b5cb72e61d855cdc924038a09b258bfcdf0c.zip
moved the `get` testing method to a module
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/test/abstract_unit.rb15
-rw-r--r--actionpack/test/controller/routing_test.rb13
2 files changed, 17 insertions, 11 deletions
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index 0a25d7ba47..b1a5356ddd 100644
--- a/actionpack/test/abstract_unit.rb
+++ b/actionpack/test/abstract_unit.rb
@@ -344,6 +344,21 @@ module ActionDispatch
end
end
+module ActionDispatch
+ module RoutingVerbs
+ def get(uri_or_host, path = nil, port = nil)
+ host = uri_or_host.host unless path
+ path ||= uri_or_host.path
+
+ params = {'PATH_INFO' => path,
+ 'REQUEST_METHOD' => 'GET',
+ 'HTTP_HOST' => host}
+
+ routes.call(params)[2].join
+ end
+ end
+end
+
module RoutingTestHelpers
def url_for(set, options, recall = nil)
set.send(:url_for, options.merge(:only_path => true, :_path_segments => recall))
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index bec9eb16f3..add238fcb0 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -73,25 +73,16 @@ end
class LegacyRouteSetTests < ActiveSupport::TestCase
include RoutingTestHelpers
+ include ActionDispatch::RoutingVerbs
attr_reader :rs
+ alias :routes :rs
def setup
@rs = ::ActionDispatch::Routing::RouteSet.new
@response = nil
end
- def get(uri_or_host, path = nil, port = nil)
- host = uri_or_host.host unless path
- path ||= uri_or_host.path
-
- params = {'PATH_INFO' => path,
- 'REQUEST_METHOD' => 'GET',
- 'HTTP_HOST' => host}
-
- @rs.call(params)[2].join
- end
-
def test_regexp_precidence
@rs.draw do
match '/whois/:domain', :constraints => {