summaryrefslogtreecommitdiff
path: root/test/rdoc/test_rdoc_servlet.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-28 07:41:19 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-28 07:41:19 +0000
commit45011d08e13878ba7593cc4aa3d112d689b9b95e (patch)
treef0008a69899f3fc93db8a688da57e72c82d84527 /test/rdoc/test_rdoc_servlet.rb
parent013521e55742a07fbc5a4b264862b2da21168b89 (diff)
* lib/rdoc/servlet.rb: Add support for serving documentation from a
subdirectory. * lib/rdoc/generator/darkfish.rb: ditto * test/rdoc/test_rdoc_servlet.rb: Test for above * test/rdoc/test_rdoc_servlet.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_servlet.rb')
-rw-r--r--test/rdoc/test_rdoc_servlet.rb23
1 files changed, 20 insertions, 3 deletions
diff --git a/test/rdoc/test_rdoc_servlet.rb b/test/rdoc/test_rdoc_servlet.rb
index e349babeb0..5c2ba4e6a7 100644
--- a/test/rdoc/test_rdoc_servlet.rb
+++ b/test/rdoc/test_rdoc_servlet.rb
@@ -1,4 +1,5 @@
require 'rdoc/test_case'
+
class TestRDocServlet < RDoc::TestCase
def setup
@@ -16,13 +17,13 @@ class TestRDocServlet < RDoc::TestCase
Gem::Specification.reset
Gem::Specification.all = [@spec]
- server = {}
- def server.mount(*) end
+ @server = {}
+ def @server.mount(*) end
@stores = {}
@cache = Hash.new { |hash, store| hash[store] = {} }
- @s = RDoc::Servlet.new server, @stores, @cache
+ @s = RDoc::Servlet.new @server, @stores, @cache
@req = WEBrick::HTTPRequest.new :Logger => nil
@res = WEBrick::HTTPResponse.new :HTTPVersion => '1.0'
@@ -126,6 +127,22 @@ class TestRDocServlet < RDoc::TestCase
assert_equal 500, @res.status
end
+ def test_do_GET_mount_path
+ @s = RDoc::Servlet.new @server, @stores, @cache, '/mount/path'
+
+ temp_dir do
+ FileUtils.touch 'rdoc.css'
+
+ @s.asset_dirs[:darkfish] = '.'
+
+ @req.path = '/mount/path/rdoc.css'
+
+ @s.do_GET @req, @res
+
+ assert_equal 'text/css', @res.content_type
+ end
+ end
+
def test_do_GET_not_modified
touch_system_cache_path
@req.header['if-modified-since'] = [(Time.now + 10).httpdate]