Class: PactBroker::Pacts::CreateFormattedDiff

Inherits:
Object
  • Object
show all
Extended by:
Pact::Matchers
Defined in:
lib/pact_broker/pacts/create_formatted_diff.rb

Class Method Summary collapse

Class Method Details

.call(pact_json_content, previous_pact_json_content) ⇒ Object



11
12
13
14
15
16
# File 'lib/pact_broker/pacts/create_formatted_diff.rb', line 11

def self.call pact_json_content, previous_pact_json_content
  pact_hash = JSON.load(pact_json_content, nil, PactBroker::PACT_PARSING_OPTIONS)
  previous_pact_hash = JSON.load(previous_pact_json_content, nil, PactBroker::PACT_PARSING_OPTIONS)
  difference = diff(previous_pact_hash, pact_hash)
  Pact::Matchers::UnixDiffFormatter.call(difference, colour: false, include_explanation: false)
end