Module: PactBroker::Client::MergePacts
Instance Method Summary collapse
- #call(pact_hashes) ⇒ Object
-
#merge(original, additional) ⇒ Object
Accepts two hashes representing pacts, outputs a merged hash Does not make any guarantees about order of interactions.
Instance Method Details
#call(pact_hashes) ⇒ Object
12 13 14 |
# File 'lib/pact_broker/client/merge_pacts.rb', line 12 def call pact_hashes pact_hashes.reduce{|p1, p2| merge(p1, p2) } end |
#merge(original, additional) ⇒ Object
Accepts two hashes representing pacts, outputs a merged hash Does not make any guarantees about order of interactions
18 19 20 21 22 23 24 25 |
# File 'lib/pact_broker/client/merge_pacts.rb', line 18 def merge original, additional new_pact = JSON.parse(original.to_json, symbolize_names: true) (new_pact, original, additional, :interactions) (new_pact, original, additional, :messages) new_pact end |