Class: AppMap::Minitest::Recording
- Defined in:
- lib/appmap/minitest.rb
Instance Attribute Summary collapse
-
#test ⇒ Object
Returns the value of attribute test.
-
#test_name ⇒ Object
Returns the value of attribute test_name.
Instance Method Summary collapse
- #finish(exception) ⇒ Object
-
#initialize(test, test_name) ⇒ Recording
constructor
A new instance of Recording.
- #source_location ⇒ Object
Constructor Details
#initialize(test, test_name) ⇒ Recording
Returns a new instance of Recording.
21 22 23 24 25 26 |
# File 'lib/appmap/minitest.rb', line 21 def initialize(test, test_name) super warn "Starting recording of test #{test.class}.#{test.name}@#{source_location}" if AppMap::Minitest::LOG @trace = AppMap.tracing.trace end |
Instance Attribute Details
#test ⇒ Object
Returns the value of attribute test
20 21 22 |
# File 'lib/appmap/minitest.rb', line 20 def test @test end |
#test_name ⇒ Object
Returns the value of attribute test_name
20 21 22 |
# File 'lib/appmap/minitest.rb', line 20 def test_name @test_name end |
Instance Method Details
#finish(exception) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/appmap/minitest.rb', line 33 def finish(exception) warn "Finishing recording of test #{test.class}.#{test.name}" if AppMap::Minitest::LOG warn "Exception: #{exception}" if exception && AppMap::Minitest::LOG events = [] AppMap.tracing.delete @trace events << @trace.next_event.to_h while @trace.event? AppMap::Minitest.add_event_methods @trace.event_methods class_map = AppMap.class_map(@trace.event_methods) feature_group = test.class.name.underscore.split('_')[0...-1].join('_').capitalize feature_name = test.name.split('_')[1..-1].join(' ') scenario_name = [ feature_group, feature_name ].join(' ') AppMap::Minitest.save name: scenario_name, class_map: class_map, source_location: source_location, test_status: exception ? 'failed' : 'succeeded', exception: exception, events: events end |
#source_location ⇒ Object
28 29 30 |
# File 'lib/appmap/minitest.rb', line 28 def source_location test.method(test_name).source_location.join(':') end |