Permalink
Browse files

moved the `get` testing method to a module

  • Loading branch information...
1 parent 5e81021 commit bce3b5cb72e61d855cdc924038a09b258bfcdf0c @tenderlove tenderlove committed Jan 23, 2012
Showing with 17 additions and 11 deletions.
  1. +15 −0 actionpack/test/abstract_unit.rb
  2. +2 −11 actionpack/test/controller/routing_test.rb
@@ -344,6 +344,21 @@ def stderr_logger
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))
@@ -73,25 +73,16 @@ def url_for(options)
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 => {

0 comments on commit bce3b5c

Please sign in to comment.