Class: Pact::Provider::RSpec::PactBrokerFormatter

Inherits:
RSpec::Core::Formatters::BaseFormatter
  • Object
show all
Defined in:
lib/pact/provider/rspec/pact_broker_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ PactBrokerFormatter

Returns a new instance of PactBrokerFormatter.



16
17
18
19
# File 'lib/pact/provider/rspec/pact_broker_formatter.rb', line 16

def initialize(output)
  super
  @output_hash = {}
end

Instance Attribute Details

#output_hashObject (readonly)

Returns the value of attribute output_hash.



14
15
16
# File 'lib/pact/provider/rspec/pact_broker_formatter.rb', line 14

def output_hash
  @output_hash
end

Instance Method Details

#close(_notification) ⇒ Object



27
28
29
# File 'lib/pact/provider/rspec/pact_broker_formatter.rb', line 27

def close(_notification)
  Pact::Provider::VerificationResults::PublishAll.call(Pact.provider_world.pact_sources, output_hash, { verbose: Pact.provider_world.verbose })
end

#stop(notification) ⇒ Object



21
22
23
24
25
# File 'lib/pact/provider/rspec/pact_broker_formatter.rb', line 21

def stop(notification)
  @output_hash[:tests] = notification
                          .examples
                          .map { |example| format_example(example) }
end