From de942e5534a26942e261a7699adc28597c5ad1bc Mon Sep 17 00:00:00 2001 From: Kamil Sobieraj Date: Tue, 4 Oct 2011 09:16:34 +0100 Subject: :subdomain can now be specified with a value of false in url_for, allowing for subdomain(s) removal from the host during link generation. Closes #2025 --- actionpack/test/dispatch/request_test.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'actionpack/test/dispatch/request_test.rb') diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index 060bcfb5ec..a611252b31 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -15,6 +15,7 @@ class RequestTest < ActiveSupport::TestCase assert_equal 'http://www.example.com', url_for assert_equal 'http://api.example.com', url_for(:subdomain => 'api') + assert_equal 'http://example.com', url_for(:subdomain => false) assert_equal 'http://www.ror.com', url_for(:domain => 'ror.com') assert_equal 'http://api.ror.co.uk', url_for(:host => 'www.ror.co.uk', :subdomain => 'api', :tld_length => 2) assert_equal 'http://www.example.com:8080', url_for(:port => 8080) -- cgit v1.2.3 From 8f0085a483ebc6d416e902c3caff68f82934e091 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Sun, 13 Nov 2011 10:19:54 -1000 Subject: change tests to expect X-F-F over REMOTE_ADDR --- actionpack/test/dispatch/request_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/test/dispatch/request_test.rb') diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index a611252b31..4658eeea17 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -36,7 +36,7 @@ class RequestTest < ActiveSupport::TestCase request = stub_request 'REMOTE_ADDR' => '1.2.3.4', 'HTTP_X_FORWARDED_FOR' => '3.4.5.6' - assert_equal '1.2.3.4', request.remote_ip + assert_equal '3.4.5.6', request.remote_ip request = stub_request 'REMOTE_ADDR' => '127.0.0.1', 'HTTP_X_FORWARDED_FOR' => '3.4.5.6' @@ -106,7 +106,7 @@ class RequestTest < ActiveSupport::TestCase request = stub_request 'REMOTE_ADDR' => '67.205.106.74,172.16.0.1', 'HTTP_X_FORWARDED_FOR' => '3.4.5.6' - assert_equal '67.205.106.74', request.remote_ip + assert_equal '3.4.5.6', request.remote_ip request = stub_request 'HTTP_X_FORWARDED_FOR' => 'unknown,67.205.106.73' assert_equal 'unknown', request.remote_ip -- cgit v1.2.3 From b8c85de62004868a34a27e58731f2a9e37aeebd0 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Mon, 14 Nov 2011 12:29:51 -1000 Subject: add test for bug fixed in 4f2bf64 --- actionpack/test/dispatch/request_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'actionpack/test/dispatch/request_test.rb') diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index 4658eeea17..4d805464c2 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -89,6 +89,11 @@ class RequestTest < ActiveSupport::TestCase assert_equal '9.9.9.9', request.remote_ip end + test "remote ip when the remote ip middleware returns nil" do + request = stub_request 'REMOTE_ADDR' => '127.0.0.1' + assert_equal '127.0.0.1', request.remote_ip + end + test "remote ip with user specified trusted proxies" do @trusted_proxies = /^67\.205\.106\.73$/i -- cgit v1.2.3