Class: RSpecEnhancedJSONFormatter

Inherits:
RSpec::Core::Formatters::BaseFormatter
  • Object
show all
Defined in:
lib/rspec_enhanced_json_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ RSpecEnhancedJSONFormatter

Returns a new instance of RSpecEnhancedJSONFormatter.



8
9
10
11
# File 'lib/rspec_enhanced_json_formatter.rb', line 8

def initialize(output)
  super
  @output = output
end

Instance Method Details

#dump_summary(summary) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/rspec_enhanced_json_formatter.rb', line 25

def dump_summary(summary)
  puts_json(
    type: 'summary',
    duration: summary.duration,
    total: summary.example_count,
    failed: summary.failure_count,
    pending: summary.pending_count
  )
end

#example_failed(failure) ⇒ Object



17
18
19
# File 'lib/rspec_enhanced_json_formatter.rb', line 17

def example_failed(failure)
  report_rspec_event(failure)
end

#example_passed(passed) ⇒ Object



13
14
15
# File 'lib/rspec_enhanced_json_formatter.rb', line 13

def example_passed(passed)
  report_rspec_event(passed)
end

#example_pending(pending) ⇒ Object



21
22
23
# File 'lib/rspec_enhanced_json_formatter.rb', line 21

def example_pending(pending)
  report_rspec_event(pending)
end