Class: RSpec::FlakeClassifier::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/flake/classifier/formatter.rb,
sig/rspec/flake/classifier.rbs

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Formatter

Returns a new instance of Formatter.

Parameters:

  • output (Object)


12
13
14
15
# File 'lib/rspec/flake/classifier/formatter.rb', line 12

def initialize(output)
  @output = output
  @failures = []
end

Instance Method Details

#dump_summary(_notification) ⇒ void

This method returns an undefined value.

Parameters:

  • notification (Object)


25
26
27
# File 'lib/rspec/flake/classifier/formatter.rb', line 25

def dump_summary(_notification)
  output.puts(JSON.pretty_generate("failures" => failures))
end

#example_failed(notification) ⇒ void

This method returns an undefined value.

Parameters:

  • notification (Object)


17
18
19
20
21
22
23
# File 'lib/rspec/flake/classifier/formatter.rb', line 17

def example_failed(notification)
  example = notification.example
  exception = notification_exception(notification, example)
  signature = Signature.from_exception(exception)
  classification = classify(example, exception)
  @failures << failure_hash(example, exception, signature, classification)
end