Module: NanDoc::SpecDoc
- Defined in:
- lib/nandoc/spec-doc.rb,
lib/nandoc/spec-doc/support-modules.rb,
lib/nandoc/spec-doc/test-case-agent.rb,
lib/nandoc/spec-doc/test-framework-proxy.rb,
lib/nandoc/spec-doc/test-framework-dispatcher.rb
Defined Under Namespace
Modules: AgentInstanceMethods, MiniTest, ParseTrace Classes: CodeSnippet, Recordings, TestCaseAgent, TestFrameworkDispatcher, TestFrameworkProxy
Class Method Summary collapse
-
.include_to(mod) ⇒ Object
enhance a test framework spec or test case module for e.g.
Instance Method Summary collapse
-
#get_sexp(testfile, testname) ⇒ Object
only run any test method at most once, just to keep recordings clean.
- #initialize(gem_root) ⇒ Object
Class Method Details
.include_to(mod) ⇒ Object
enhance a test framework spec or test case module for e.g. a minitest spec class.
20 21 22 23 24 25 26 27 28 |
# File 'lib/nandoc/spec-doc.rb', line 20 def include_to mod if Object.const_defined?('MiniTest') && mod.ancestors.include?(::MiniTest::Spec) require File.dirname(__FILE__)+'/spec-doc/mini-test.rb' ::NanDoc::SpecDoc::MiniTest::SpecInstanceMethods.include_to mod else fail("don't know how to enhance test module: #{mod}") end end |
Instance Method Details
#get_sexp(testfile, testname) ⇒ Object
only run any test method at most once, just to keep recordings clean
39 40 41 42 43 44 |
# File 'lib/nandoc/spec-doc.rb', line 39 def get_sexp testfile, testname sexp = @sexp_cache[testfile][testname] ||= begin @test_framework_dispatcher.get_sexp testfile, testname end sexp end |
#initialize(gem_root) ⇒ Object
31 32 33 34 |
# File 'lib/nandoc/spec-doc.rb', line 31 def initialize gem_root @sexp_cache = Hash.new{|h,k| h[k] = {}} @test_framework_dispatcher = TestFrameworkDispatcher.new(gem_root) end |