aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/request_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller/request_test.rb')
-rw-r--r--actionpack/test/controller/request_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb
new file mode 100644
index 0000000000..1f38d07a03
--- /dev/null
+++ b/actionpack/test/controller/request_test.rb
@@ -0,0 +1,26 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+class RequestTest < Test::Unit::TestCase
+ def setup
+ @request = ActionController::TestRequest.new
+ end
+
+ def test_domains
+ @request.host = "www.rubyonrails.org"
+ assert_equal "rubyonrails.org", @request.domain
+
+ @request.host = "www.rubyonrails.co.uk"
+ assert_equal "rubyonrails.co.uk", @request.domain(2)
+ end
+
+ def test_subdomains
+ @request.host = "www.rubyonrails.org"
+ assert_equal %w( www ), @request.subdomains
+
+ @request.host = "www.rubyonrails.co.uk"
+ assert_equal %w( www ), @request.subdomains(2)
+
+ @request.host = "dev.www.rubyonrails.co.uk"
+ assert_equal %w( dev www ), @request.subdomains(2)
+ end
+end \ No newline at end of file