Class: Minitest::Apidoc::Reporter

Inherits:
Reporter
  • Object
show all
Defined in:
lib/minitest/apidoc/reporter.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReporter

Returns a new instance of Reporter


8
9
10
11
# File 'lib/minitest/apidoc/reporter.rb', line 8

def initialize
  @endpoints = {}
  @tests = []
end

Class Attribute Details

.enable_pluginObject

Returns the value of attribute enable_plugin


5
6
7
# File 'lib/minitest/apidoc/reporter.rb', line 5

def enable_plugin
  @enable_plugin
end

Instance Method Details

#passed?Boolean

Returns:

  • (Boolean)

30
31
32
33
# File 'lib/minitest/apidoc/reporter.rb', line 30

def passed?
  groups = Group.from(@endpoints)
  Template.new(groups).write
end

#record(test) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/minitest/apidoc/reporter.rb', line 13

def record(test)
  if @tests.last.class != test.class
    @endpoints[test.class] = Endpoint.new
    @endpoints[test.class]. = test.class.
    @endpoints[test.class].params = test.class.params
  end

  if test.passed?
    @endpoints[test.class].examples << {
      :title    => test.class.[:example_name],
      :request  => test.class.[:request],
      :response => test.class.[:response]
    }
  end
  @tests << test
end