2015-12-16 00:07:31 -05:00
|
|
|
# frozen_string_literal: false
|
2012-11-26 23:28:14 -05:00
|
|
|
require 'rdoc/test_case'
|
2012-11-28 02:41:19 -05:00
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
class TestRDocServlet < RDoc::TestCase
|
|
|
|
|
|
|
|
def setup
|
|
|
|
super
|
|
|
|
|
|
|
|
@orig_gem_path = Gem.path
|
|
|
|
|
|
|
|
@tempdir = File.join Dir.tmpdir, "test_rdoc_servlet_#{$$}"
|
|
|
|
Gem.use_paths @tempdir
|
|
|
|
Gem.ensure_gem_subdirectories @tempdir
|
|
|
|
|
|
|
|
@spec = Gem::Specification.new 'spec', '1.0'
|
2013-01-22 20:02:24 -05:00
|
|
|
@spec.loaded_from = @spec.spec_file
|
2012-11-26 23:28:14 -05:00
|
|
|
|
|
|
|
Gem::Specification.reset
|
|
|
|
Gem::Specification.all = [@spec]
|
|
|
|
|
2012-11-28 02:41:19 -05:00
|
|
|
@server = {}
|
|
|
|
def @server.mount(*) end
|
2012-11-26 23:28:14 -05:00
|
|
|
|
|
|
|
@stores = {}
|
|
|
|
@cache = Hash.new { |hash, store| hash[store] = {} }
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
@extra_dirs = [File.join(@tempdir, 'extra1'), File.join(@tempdir, 'extra2')]
|
|
|
|
|
|
|
|
@s = RDoc::Servlet.new @server, @stores, @cache, nil, @extra_dirs
|
2012-11-26 23:28:14 -05:00
|
|
|
|
|
|
|
@req = WEBrick::HTTPRequest.new :Logger => nil
|
|
|
|
@res = WEBrick::HTTPResponse.new :HTTPVersion => '1.0'
|
|
|
|
|
|
|
|
def @req.path= path
|
|
|
|
instance_variable_set :@path, path
|
|
|
|
end
|
|
|
|
|
|
|
|
@req.instance_variable_set :@header, Hash.new { |h, k| h[k] = [] }
|
|
|
|
|
2013-01-22 20:02:24 -05:00
|
|
|
@base = File.join @tempdir, 'base'
|
|
|
|
@system_dir = File.join @tempdir, 'base', 'system'
|
|
|
|
@home_dir = File.join @tempdir, 'home'
|
2013-02-05 19:30:19 -05:00
|
|
|
@gem_doc_dir = File.join @tempdir, 'doc'
|
2012-11-26 23:28:14 -05:00
|
|
|
|
|
|
|
@orig_base = RDoc::RI::Paths::BASE
|
|
|
|
RDoc::RI::Paths::BASE.replace @base
|
|
|
|
@orig_ri_path_homedir = RDoc::RI::Paths::HOMEDIR
|
2013-01-22 20:02:24 -05:00
|
|
|
RDoc::RI::Paths::HOMEDIR.replace @home_dir
|
2012-11-26 23:28:14 -05:00
|
|
|
|
|
|
|
RDoc::RI::Paths.instance_variable_set \
|
|
|
|
:@gemdirs, %w[/nonexistent/gems/example-1.0/ri]
|
|
|
|
end
|
|
|
|
|
|
|
|
def teardown
|
|
|
|
super
|
|
|
|
|
|
|
|
Gem.use_paths(*@orig_gem_path)
|
|
|
|
Gem::Specification.reset
|
|
|
|
|
|
|
|
FileUtils.rm_rf @tempdir
|
|
|
|
|
|
|
|
RDoc::RI::Paths::BASE.replace @orig_base
|
|
|
|
RDoc::RI::Paths::HOMEDIR.replace @orig_ri_path_homedir
|
|
|
|
RDoc::RI::Paths.instance_variable_set :@gemdirs, nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_asset
|
|
|
|
temp_dir do
|
2016-09-05 06:35:30 -04:00
|
|
|
FileUtils.mkdir 'css'
|
2012-11-26 23:28:14 -05:00
|
|
|
|
2016-09-05 06:35:30 -04:00
|
|
|
now = Time.now
|
|
|
|
open 'css/rdoc.css', 'w' do |io| io.write 'h1 { color: red }' end
|
|
|
|
File.utime now, now, 'css/rdoc.css'
|
2012-11-26 23:28:14 -05:00
|
|
|
|
|
|
|
@s.asset_dirs[:darkfish] = '.'
|
|
|
|
|
2016-09-05 06:35:30 -04:00
|
|
|
@req.path = '/css/rdoc.css'
|
2012-11-26 23:28:14 -05:00
|
|
|
|
|
|
|
@s.asset :darkfish, @req, @res
|
|
|
|
|
|
|
|
assert_equal 'h1 { color: red }', @res.body
|
|
|
|
assert_equal 'text/css', @res.content_type
|
|
|
|
assert_equal now.httpdate, @res['last-modified']
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_do_GET
|
|
|
|
touch_system_cache_path
|
|
|
|
|
|
|
|
@req.path = '/ruby/Missing.html'
|
|
|
|
|
|
|
|
@s.do_GET @req, @res
|
|
|
|
|
|
|
|
assert_equal 404, @res.status
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_do_GET_asset_darkfish
|
|
|
|
temp_dir do
|
2016-09-05 06:35:30 -04:00
|
|
|
FileUtils.mkdir 'css'
|
|
|
|
FileUtils.touch 'css/rdoc.css'
|
2012-11-26 23:28:14 -05:00
|
|
|
|
|
|
|
@s.asset_dirs[:darkfish] = '.'
|
|
|
|
|
2016-09-05 06:35:30 -04:00
|
|
|
@req.path = '/css/rdoc.css'
|
2012-11-26 23:28:14 -05:00
|
|
|
|
|
|
|
@s.do_GET @req, @res
|
|
|
|
|
|
|
|
assert_equal 'text/css', @res.content_type
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_do_GET_asset_json_index
|
|
|
|
temp_dir do
|
|
|
|
FileUtils.mkdir 'js'
|
|
|
|
FileUtils.touch 'js/navigation.js'
|
|
|
|
|
|
|
|
@s.asset_dirs[:json_index] = '.'
|
|
|
|
|
|
|
|
@req.path = '/js/navigation.js'
|
|
|
|
|
|
|
|
@s.do_GET @req, @res
|
|
|
|
|
|
|
|
assert_equal 'application/javascript', @res.content_type
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_do_GET_error
|
|
|
|
touch_system_cache_path
|
|
|
|
|
|
|
|
def @req.path() raise 'no' end
|
|
|
|
|
|
|
|
@s.do_GET @req, @res
|
|
|
|
|
|
|
|
assert_equal 500, @res.status
|
|
|
|
end
|
|
|
|
|
2012-11-28 02:41:19 -05:00
|
|
|
def test_do_GET_mount_path
|
|
|
|
@s = RDoc::Servlet.new @server, @stores, @cache, '/mount/path'
|
|
|
|
|
|
|
|
temp_dir do
|
2016-09-05 06:35:30 -04:00
|
|
|
FileUtils.mkdir 'css'
|
|
|
|
FileUtils.touch 'css/rdoc.css'
|
2012-11-28 02:41:19 -05:00
|
|
|
|
|
|
|
@s.asset_dirs[:darkfish] = '.'
|
|
|
|
|
2016-09-05 06:35:30 -04:00
|
|
|
@req.path = '/mount/path/css/rdoc.css'
|
2012-11-28 02:41:19 -05:00
|
|
|
|
|
|
|
@s.do_GET @req, @res
|
|
|
|
|
|
|
|
assert_equal 'text/css', @res.content_type
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
def do_GET_not_found
|
|
|
|
touch_system_cache_path
|
|
|
|
|
|
|
|
@req.path = "/#{@spec.full_name}"
|
|
|
|
|
|
|
|
@s.do_GET @req, @res
|
|
|
|
|
|
|
|
assert_equal 404, @res.status
|
|
|
|
end
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
def test_do_GET_not_modified
|
|
|
|
touch_system_cache_path
|
|
|
|
@req.header['if-modified-since'] = [(Time.now + 10).httpdate]
|
|
|
|
@req.path = '/ruby/Missing.html'
|
|
|
|
|
|
|
|
assert_raises WEBrick::HTTPStatus::NotModified do
|
|
|
|
@s.do_GET @req, @res
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_do_GET_root
|
|
|
|
touch_system_cache_path
|
|
|
|
|
|
|
|
@req.path = '/'
|
|
|
|
|
|
|
|
@s.do_GET @req, @res
|
|
|
|
|
|
|
|
assert_equal 'text/html', @res.content_type
|
|
|
|
assert_match %r%<title>Local RDoc Documentation</title>%, @res.body
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_do_GET_root_search
|
|
|
|
touch_system_cache_path
|
|
|
|
|
|
|
|
@req.path = '/js/search_index.js'
|
|
|
|
|
|
|
|
@s.do_GET @req, @res
|
|
|
|
|
2015-06-16 20:50:15 -04:00
|
|
|
assert_equal 'application/javascript', @res.content_type, @res.body
|
2012-11-26 23:28:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_documentation_page_class
|
|
|
|
store = RDoc::Store.new
|
|
|
|
|
|
|
|
generator = @s.generator_for store
|
|
|
|
|
|
|
|
file = store.add_file 'file.rb'
|
|
|
|
klass = file.add_class RDoc::NormalClass, 'Klass'
|
|
|
|
klass.add_class RDoc::NormalClass, 'Sub'
|
|
|
|
|
|
|
|
@s.documentation_page store, generator, 'Klass::Sub.html', @req, @res
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
assert_match %r%<title>class Klass::Sub - </title>%, @res.body
|
|
|
|
assert_match %r%<body id="top" role="document" class="class">%, @res.body
|
2012-11-26 23:28:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_documentation_page_not_found
|
|
|
|
store = RDoc::Store.new
|
|
|
|
|
|
|
|
generator = @s.generator_for store
|
|
|
|
|
|
|
|
@req.path = '/ruby/Missing.html'
|
|
|
|
|
|
|
|
@s.documentation_page store, generator, 'Missing.html', @req, @res
|
|
|
|
|
|
|
|
assert_equal 404, @res.status
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_documentation_page_page
|
|
|
|
store = RDoc::Store.new
|
|
|
|
|
|
|
|
generator = @s.generator_for store
|
|
|
|
|
|
|
|
readme = store.add_file 'README.rdoc'
|
|
|
|
readme.parser = RDoc::Parser::Simple
|
|
|
|
|
|
|
|
@s.documentation_page store, generator, 'README_rdoc.html', @req, @res
|
|
|
|
|
|
|
|
assert_match %r%<title>README - </title>%, @res.body
|
2013-09-18 19:33:36 -04:00
|
|
|
assert_match %r%<body [^>]+ class="file">%, @res.body
|
2012-11-26 23:28:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_documentation_source
|
|
|
|
store, path = @s.documentation_source '/ruby/Object.html'
|
|
|
|
|
|
|
|
assert_equal @system_dir, store.path
|
|
|
|
|
|
|
|
assert_equal 'Object.html', path
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_documentation_source_cached
|
|
|
|
cached_store = RDoc::Store.new
|
|
|
|
|
|
|
|
@stores['ruby'] = cached_store
|
|
|
|
|
|
|
|
store, path = @s.documentation_source '/ruby/Object.html'
|
|
|
|
|
|
|
|
assert_same cached_store, store
|
|
|
|
|
|
|
|
assert_equal 'Object.html', path
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_error
|
|
|
|
e = RuntimeError.new 'foo'
|
|
|
|
e.set_backtrace caller
|
|
|
|
|
|
|
|
@s.error e, @req, @res
|
|
|
|
|
|
|
|
assert_equal 'text/html', @res.content_type
|
|
|
|
assert_equal 500, @res.status
|
|
|
|
assert_match %r%<title>Error%, @res.body
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_generator_for
|
|
|
|
store = RDoc::Store.new
|
|
|
|
store.main = 'MAIN_PAGE.rdoc'
|
|
|
|
store.title = 'Title'
|
|
|
|
|
|
|
|
generator = @s.generator_for store
|
|
|
|
|
|
|
|
refute generator.file_output
|
|
|
|
|
|
|
|
assert_equal '..', generator.asset_rel_path
|
|
|
|
|
|
|
|
assert_equal 'MAIN_PAGE.rdoc', @s.options.main_page
|
|
|
|
assert_equal 'Title', @s.options.title
|
|
|
|
|
|
|
|
assert_kind_of RDoc::RDoc, store.rdoc
|
|
|
|
assert_same generator, store.rdoc.generator
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_if_modified_since
|
2012-11-27 02:09:21 -05:00
|
|
|
skip 'File.utime on directory not supported' if Gem.win_platform?
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
temp_dir do
|
|
|
|
now = Time.now
|
|
|
|
File.utime now, now, '.'
|
|
|
|
|
|
|
|
@s.if_modified_since @req, @res, '.'
|
|
|
|
|
|
|
|
assert_equal now.to_i, Time.parse(@res['last-modified']).to_i
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_if_modified_since_not_modified
|
2012-11-27 02:09:21 -05:00
|
|
|
skip 'File.utime on directory not supported' if Gem.win_platform?
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
temp_dir do
|
|
|
|
now = Time.now
|
|
|
|
File.utime now, now, '.'
|
|
|
|
|
|
|
|
@req.header['if-modified-since'] = [(now + 10).httpdate]
|
|
|
|
|
|
|
|
assert_raises WEBrick::HTTPStatus::NotModified do
|
|
|
|
@s.if_modified_since @req, @res, '.'
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_equal now.to_i, Time.parse(@res['last-modified']).to_i
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_installed_docs
|
|
|
|
touch_system_cache_path
|
2013-09-18 19:33:36 -04:00
|
|
|
touch_extra_cache_path
|
2012-11-26 23:28:14 -05:00
|
|
|
|
|
|
|
expected = [
|
2013-09-18 19:33:36 -04:00
|
|
|
['My Extra Documentation', 'extra-1/', true, :extra,
|
|
|
|
@extra_dirs[0]],
|
|
|
|
['Extra Documentation', 'extra-2/', false, :extra,
|
|
|
|
@extra_dirs[1]],
|
2012-11-26 23:28:14 -05:00
|
|
|
['Ruby Documentation', 'ruby/', true, :system,
|
|
|
|
@system_dir],
|
|
|
|
['Site Documentation', 'site/', false, :site,
|
|
|
|
File.join(@base, 'site')],
|
|
|
|
['Home Documentation', 'home/', false, :home,
|
|
|
|
RDoc::RI::Paths::HOMEDIR],
|
|
|
|
['spec-1.0', 'spec-1.0/', false, :gem,
|
|
|
|
File.join(@spec.doc_dir, 'ri')],
|
|
|
|
]
|
|
|
|
|
|
|
|
assert_equal expected, @s.installed_docs
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_not_found
|
|
|
|
generator = @s.generator_for RDoc::Store.new
|
|
|
|
|
|
|
|
@req.path = '/ruby/Missing.html'
|
|
|
|
|
|
|
|
@s.not_found generator, @req, @res
|
|
|
|
|
|
|
|
assert_equal 404, @res.status
|
|
|
|
assert_match %r%<title>Not Found</title>%, @res.body
|
|
|
|
assert_match %r%<kbd>/ruby/Missing\.html</kbd>%, @res.body
|
|
|
|
end
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
def test_not_found_message
|
|
|
|
generator = @s.generator_for RDoc::Store.new
|
|
|
|
|
|
|
|
@req.path = '/ruby/Missing.html'
|
|
|
|
|
|
|
|
@s.not_found generator, @req, @res, 'woo, this is a message'
|
|
|
|
|
|
|
|
assert_equal 404, @res.status
|
|
|
|
assert_match %r%<title>Not Found</title>%, @res.body
|
|
|
|
assert_match %r%woo, this is a message%, @res.body
|
|
|
|
end
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
def test_ri_paths
|
|
|
|
paths = @s.ri_paths
|
|
|
|
|
|
|
|
expected = [
|
2013-09-18 19:33:36 -04:00
|
|
|
[@extra_dirs[0], :extra],
|
|
|
|
[@extra_dirs[1], :extra],
|
2012-11-26 23:28:14 -05:00
|
|
|
[@system_dir, :system],
|
|
|
|
[File.join(@base, 'site'), :site],
|
|
|
|
[RDoc::RI::Paths::HOMEDIR, :home],
|
|
|
|
[File.join(@spec.doc_dir, 'ri'), :gem],
|
|
|
|
]
|
|
|
|
|
|
|
|
assert_equal expected, paths.to_a
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_root
|
|
|
|
@s.root @req, @res
|
|
|
|
|
|
|
|
assert_equal 'text/html', @res.content_type
|
|
|
|
assert_match %r%<title>Local RDoc Documentation</title>%, @res.body
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_root_search
|
|
|
|
touch_system_cache_path
|
2013-09-18 19:33:36 -04:00
|
|
|
touch_extra_cache_path
|
2012-11-26 23:28:14 -05:00
|
|
|
|
|
|
|
@s.root_search @req, @res
|
|
|
|
|
|
|
|
assert_equal 'application/javascript', @res.content_type
|
|
|
|
|
|
|
|
@res.body =~ /\{.*\}/
|
|
|
|
|
|
|
|
index = JSON.parse $&
|
|
|
|
|
|
|
|
expected = {
|
|
|
|
'index' => {
|
|
|
|
'searchIndex' => %w[
|
2013-09-18 19:33:36 -04:00
|
|
|
My\ Extra\ Documentation
|
2012-11-26 23:28:14 -05:00
|
|
|
Ruby\ Documentation
|
|
|
|
],
|
|
|
|
'longSearchIndex' => %w[
|
2013-09-18 19:33:36 -04:00
|
|
|
My\ Extra\ Documentation
|
2012-11-26 23:28:14 -05:00
|
|
|
Ruby\ Documentation
|
|
|
|
],
|
|
|
|
'info' => [
|
2013-09-18 19:33:36 -04:00
|
|
|
['My Extra Documentation', '', @extra_dirs[0], '',
|
|
|
|
'My Extra Documentation'],
|
2013-02-05 03:24:20 -05:00
|
|
|
['Ruby Documentation', '', 'ruby', '',
|
2012-11-26 23:28:14 -05:00
|
|
|
'Documentation for the Ruby standard library'],
|
|
|
|
],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
assert_equal expected, index
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_show_documentation_index
|
|
|
|
touch_system_cache_path
|
|
|
|
|
|
|
|
@req.path = '/ruby'
|
|
|
|
|
|
|
|
@s.show_documentation @req, @res
|
|
|
|
|
|
|
|
assert_equal 'text/html', @res.content_type
|
|
|
|
assert_match %r%<title>Standard Library Documentation%, @res.body
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_show_documentation_table_of_contents
|
|
|
|
touch_system_cache_path
|
|
|
|
|
|
|
|
@req.path = '/ruby/table_of_contents.html'
|
|
|
|
|
|
|
|
@s.show_documentation @req, @res
|
|
|
|
|
|
|
|
assert_equal 'text/html', @res.content_type
|
|
|
|
assert_match %r%<title>Table of Contents - Standard Library Documentation%,
|
|
|
|
@res.body
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_show_documentation_page
|
|
|
|
touch_system_cache_path
|
|
|
|
|
|
|
|
@req.path = '/ruby/Missing.html'
|
|
|
|
|
|
|
|
@s.show_documentation @req, @res
|
|
|
|
|
|
|
|
assert_equal 404, @res.status
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_show_documentation_search_index
|
|
|
|
touch_system_cache_path
|
|
|
|
|
|
|
|
@req.path = '/ruby/js/search_index.js'
|
|
|
|
|
|
|
|
@s.show_documentation @req, @res
|
|
|
|
|
|
|
|
assert_equal 'application/javascript', @res.content_type
|
|
|
|
assert_match %r%\Avar search_data =%, @res.body
|
|
|
|
end
|
|
|
|
|
2013-01-22 20:02:24 -05:00
|
|
|
def test_store_for_gem
|
2013-09-18 19:33:36 -04:00
|
|
|
ri_dir = File.join @gem_doc_dir, 'spec-1.0', 'ri'
|
|
|
|
FileUtils.mkdir_p ri_dir
|
|
|
|
FileUtils.touch File.join ri_dir, 'cache.ri'
|
|
|
|
|
2013-01-22 20:02:24 -05:00
|
|
|
store = @s.store_for 'spec-1.0'
|
|
|
|
|
|
|
|
assert_equal File.join(@gem_doc_dir, 'spec-1.0', 'ri'), store.path
|
|
|
|
assert_equal :gem, store.type
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_store_for_home
|
|
|
|
store = @s.store_for 'home'
|
|
|
|
|
|
|
|
assert_equal @home_dir, store.path
|
|
|
|
assert_equal :home, store.type
|
|
|
|
end
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
def test_store_for_missing_documentation
|
|
|
|
FileUtils.mkdir_p(File.join @gem_doc_dir, 'spec-1.0', 'ri')
|
|
|
|
|
|
|
|
e = assert_raises WEBrick::HTTPStatus::NotFound do
|
|
|
|
@s.store_for 'spec-1.0'
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_equal 'Could not find documentation for "spec-1.0". Please run `gem rdoc --ri gem_name`',
|
|
|
|
e.message
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_store_for_missing_gem
|
|
|
|
e = assert_raises WEBrick::HTTPStatus::NotFound do
|
2013-01-22 20:02:24 -05:00
|
|
|
@s.store_for 'missing'
|
|
|
|
end
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
assert_equal 'Could not find gem "missing". Are you sure you installed it?',
|
|
|
|
e.message
|
2013-01-22 20:02:24 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_store_for_ruby
|
|
|
|
store = @s.store_for 'ruby'
|
|
|
|
|
|
|
|
assert_equal @system_dir, store.path
|
|
|
|
assert_equal :system, store.type
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_store_for_site
|
|
|
|
store = @s.store_for 'site'
|
|
|
|
|
|
|
|
assert_equal File.join(@base, 'site'), store.path
|
|
|
|
assert_equal :site, store.type
|
|
|
|
end
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
def test_store_for_extra
|
|
|
|
store = @s.store_for 'extra-1'
|
|
|
|
|
|
|
|
assert_equal @extra_dirs.first, store.path
|
|
|
|
assert_equal :extra, store.type
|
|
|
|
end
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
def touch_system_cache_path
|
|
|
|
store = RDoc::Store.new @system_dir
|
|
|
|
store.title = 'Standard Library Documentation'
|
|
|
|
|
|
|
|
FileUtils.mkdir_p File.dirname store.cache_path
|
|
|
|
|
|
|
|
store.save
|
|
|
|
end
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
def touch_extra_cache_path
|
|
|
|
store = RDoc::Store.new @extra_dirs.first
|
|
|
|
store.title = 'My Extra Documentation'
|
|
|
|
|
|
|
|
FileUtils.mkdir_p File.dirname store.cache_path
|
|
|
|
|
|
|
|
store.save
|
|
|
|
end
|
|
|
|
|
2015-04-12 04:36:37 -04:00
|
|
|
end
|