diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2011-12-20 20:34:04 +0100 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2012-01-10 04:39:53 +0100 |
commit | 79b12a0ffbffc05186d489e0f553aa8f2a50d5b7 (patch) | |
tree | c833eee29b7627c7d94d5ee9d118b7809b411b83 /actionpack/test/dispatch | |
parent | 63305daeba3d85442b3a84d4df0c83f59250c7cb (diff) | |
download | rails-79b12a0ffbffc05186d489e0f553aa8f2a50d5b7.tar.gz rails-79b12a0ffbffc05186d489e0f553aa8f2a50d5b7.tar.bz2 rails-79b12a0ffbffc05186d489e0f553aa8f2a50d5b7.zip |
Add original_fullpath and original_url methods to Request
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/request_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index 4d805464c2..5b3d38c48c 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -618,6 +618,30 @@ class RequestTest < ActiveSupport::TestCase assert_equal "/authenticate?secret", path end + test "original_fullpath returns ORIGINAL_FULLPATH" do + request = stub_request('ORIGINAL_FULLPATH' => "/foo?bar") + + path = request.original_fullpath + assert_equal "/foo?bar", path + end + + test "original_url returns url built using ORIGINAL_FULLPATH" do + request = stub_request('ORIGINAL_FULLPATH' => "/foo?bar", + 'HTTP_HOST' => "example.org", + 'rack.url_scheme' => "http") + + url = request.original_url + assert_equal "http://example.org/foo?bar", url + end + + test "original_fullpath returns fullpath if ORIGINAL_FULLPATH is not present" do + request = stub_request('PATH_INFO' => "/foo", + 'QUERY_STRING' => "bar") + + path = request.original_fullpath + assert_equal "/foo?bar", path + end + protected def stub_request(env = {}) |