Skip to content

Commit

Permalink
fix: correct order of arguments for merging pacts
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Nov 14, 2018
1 parent 9fdcc57 commit f6cfb19
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/pact_broker/pacts/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def merge_pact params
consumer_version = version_repository.find_by_pacticipant_id_and_number_or_create consumer.id, params[:consumer_version_number]
existing_pact = pact_repository.find_by_version_and_provider(consumer_version.id, provider.id)

params.merge!(json_content: Merger.merge_pacts(params[:json_content], existing_pact.json_content))
params.merge!(json_content: Merger.merge_pacts(existing_pact.json_content, params[:json_content]))

update_pact params, existing_pact
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/merge_pact_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
let(:merged_pact_content) { load_fixture('a_consumer-a_provider-merged.json') }

before do
TestDataBuilder.new.create_pact_with_hierarchy("A Consumer", "1.2.3", "A Provider", existing_pact_content).and_return(:pact)
TestDataBuilder.new.create_pact_with_hierarchy("A Consumer", "1.2.3", "A Provider", existing_pact_content)
end

it "returns a 200 Success" do
Expand Down
8 changes: 4 additions & 4 deletions spec/fixtures/a_consumer-a_provider-merged.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
},
"interactions": [
{
"description" : "a request for something",
"description" : "another request for something",
"providerState": null,
"request": {
"method": "get",
"path" : "/something"
"path" : "/something_else"
},
"response": {
"status": 200,
"body" : "something"
}
},
{
"description" : "another request for something",
"description" : "a request for something",
"providerState": null,
"request": {
"method": "get",
"path" : "/something_else"
"path" : "/something"
},
"response": {
"status": 200,
Expand Down

0 comments on commit f6cfb19

Please sign in to comment.