RDoc::TestCase is an abstract TestCase to provide common setup and teardown across all RDoc tests. The test case uses minitest, so all the assertions of minitest may be used.
The testcase provides the following:
A reset code-object tree
A reset markup preprocessor (RDoc::Markup::PreProcess)
The @RM
alias of RDoc::Markup (for
less typing)
@pwd
containing the current working directory
FileUtils, pp, Tempfile, Dir.tmpdir and StringIO
Creates an RDoc::Comment with text
which was defined on top_level
. By default the comment has the
'rdoc' format.
# File lib/rdoc/test_case.rb, line 48 def comment text, top_level = @top_level RDoc::Comment.new text, top_level end
Abstract test-case setup
# File lib/rdoc/test_case.rb, line 31 def setup super @top_level = nil @RM = RDoc::Markup RDoc::RDoc.reset RDoc::Markup::PreProcess.reset @pwd = Dir.pwd end
Creates a temporary directory changes the current directory to it for the duration of the block.
Depends upon Dir.mktmpdir
# File lib/rdoc/test_case.rb, line 58 def temp_dir skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir Dir.mktmpdir do |temp_dir| Dir.chdir temp_dir do yield temp_dir end end end