class PactBroker::Pacts::CreateFormattedDiff
Public Class Methods
call(pact_json_content, previous_pact_json_content, raw: false)
click to toggle source
# File lib/pact_broker/pacts/create_formatted_diff.rb, line 12 def self.call pact_json_content, previous_pact_json_content, raw: false 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) if !raw pact_hash = SortContent.call(PactBroker::Pacts::Content.from_hash(pact_hash).without_ids.to_hash) previous_pact_hash = SortContent.call(PactBroker::Pacts::Content.from_hash(previous_pact_hash).without_ids.to_hash) end difference = diff(previous_pact_hash, pact_hash) Pact::Matchers::UnixDiffFormatter.call(difference, colour: false, include_explanation: false) end