Class: Petitest::Subscribers::JsonReportSubscriber
- Inherits:
-
BaseSubscriber
- Object
- BaseSubscriber
- Petitest::Subscribers::JsonReportSubscriber
- Defined in:
- lib/petitest/subscribers/json_report_subscriber.rb
Instance Attribute Summary
Attributes included from Petitest::SubscriberConcerns::TimeConcern
Instance Method Summary collapse
Methods included from Petitest::SubscriberConcerns::TimeConcern
Methods inherited from BaseSubscriber
#after_running_test, #after_running_test_group, #before_running_test, #before_running_test_group, #before_running_test_plan
Instance Method Details
#after_running_test_plan(test_plan) ⇒ Object
Note:
Override
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/petitest/subscribers/json_report_subscriber.rb', line 13 def after_running_test_plan(test_plan) super data = { tests: test_plan.tests.map do |test| { backtrace: test.runner.backtrace, class_name: test.class.to_s, error_class_name: test.runner.error_class_name, error_message: test.runner., failed: test.runner.failed?, finished_at: test.runner.finished_at.iso8601(6), method_line_number: test.runner.test_method.line_number, method_name: test.runner.test_method.method_name, path: test.runner.test_method.path, skipped: test.runner.skipped?, started_at: test.runner.started_at.iso8601(6), } end, times: { finished_at: finished_at.iso8601(6), started_at: started_at.iso8601(6), }, } string = ::JSON.pretty_generate(data) output.puts(string) end |