Class: NanDoc::SpecDoc::TestFrameworkProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/nandoc/spec-doc/test-framework-proxy.rb

Direct Known Subclasses

MiniTest::Proxy

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gem_root) ⇒ TestFrameworkProxy

abstract baseclass, an agent that runs tests



5
6
7
# File 'lib/nandoc/spec-doc/test-framework-proxy.rb', line 5

def initialize gem_root
  @gem_root = gem_root
end

Class Attribute Details

.sexp_cacheObject (readonly)

Returns the value of attribute sexp_cache.



29
30
31
# File 'lib/nandoc/spec-doc/test-framework-proxy.rb', line 29

def sexp_cache
  @sexp_cache
end

Instance Method Details

#build_sexp(testfile, testname) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/nandoc/spec-doc/test-framework-proxy.rb', line 15

def build_sexp testfile, testname
  load_file testfile
  test_case, meth_name = find_test testname
  run_test_case_method testfile, testname, test_case, meth_name
  recs = ::NanDoc::SpecDoc::Recordings.for_test_case[test_case] or
    fail(::NanDoc::SpecDoc::Recordings.
                           report_test_case_not_found(test_case))
  sexp = recs.get_first_sexp_for_test_method(meth_name) or
    fail recs.report_recording_not_found(meth_name)
  sexp
end

#get_sexp(testfile, testname) ⇒ Object



9
10
11
12
13
# File 'lib/nandoc/spec-doc/test-framework-proxy.rb', line 9

def get_sexp testfile, testname
  TestFrameworkProxy.sexp_cache[testfile][testname] ||= begin
    build_sexp testfile, testname
  end
end