aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/request_test.rb
diff options
context:
space:
mode:
authorSimon Jefford <simon.jefford@gmail.com>2010-07-27 15:39:28 +0100
committerwycats <wycats@gmail.com>2010-09-09 18:26:35 -0700
commit7fae0aa4ac116bcbf522a9a4f19972c653d366fa (patch)
treebd10694c9fad90d35b44150168c3d1df03bbb6b2 /actionpack/test/dispatch/request_test.rb
parent5949e705f496c78fa125610d581a9339fa63da94 (diff)
downloadrails-7fae0aa4ac116bcbf522a9a4f19972c653d366fa.tar.gz
rails-7fae0aa4ac116bcbf522a9a4f19972c653d366fa.tar.bz2
rails-7fae0aa4ac116bcbf522a9a4f19972c653d366fa.zip
Add configuration option for tld length
Diffstat (limited to 'actionpack/test/dispatch/request_test.rb')
-rw-r--r--actionpack/test/dispatch/request_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb
index 546c4cb253..a8b8f9377b 100644
--- a/actionpack/test/dispatch/request_test.rb
+++ b/actionpack/test/dispatch/request_test.rb
@@ -116,6 +116,9 @@ class RequestTest < ActiveSupport::TestCase
request = stub_request 'HTTP_HOST' => "dev.www.rubyonrails.co.uk"
assert_equal %w( dev www ), request.subdomains(2)
+ request = stub_request 'HTTP_HOST' => "dev.www.rubyonrails.co.uk", :tld_length => 2
+ assert_equal %w( dev www ), request.subdomains
+
request = stub_request 'HTTP_HOST' => "foobar.foobar.com"
assert_equal %w( foobar ), request.subdomains
@@ -472,7 +475,9 @@ protected
def stub_request(env = {})
ip_spoofing_check = env.key?(:ip_spoofing_check) ? env.delete(:ip_spoofing_check) : true
ip_app = ActionDispatch::RemoteIp.new(Proc.new { }, ip_spoofing_check, @trusted_proxies)
+ tld_length = env.key?(:tld_length) ? env.delete(:tld_length) : 1
ip_app.call(env)
+ ActionDispatch::Http::URL.tld_length = tld_length
ActionDispatch::Request.new(env)
end