Skip to content

Commit

Permalink
fix: handle deleting integration when consumer and provider are the s…
Browse files Browse the repository at this point in the history
…ame pacticipant
  • Loading branch information
bethesque committed Apr 15, 2019
1 parent 07652b5 commit f31e8df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pact_broker/integrations/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def self.delete(consumer_name, provider_name)
version_repository.delete_orphan_versions(consumer, provider)

pacticipant_service.delete_if_orphan(consumer)
pacticipant_service.delete_if_orphan(provider)
pacticipant_service.delete_if_orphan(provider) unless consumer == provider
end
end
end
Expand Down
13 changes: 13 additions & 0 deletions spec/lib/pact_broker/integrations/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,19 @@ module Integrations
expect { subject }.to change { PactBroker::Domain::Version.count }
end
end

context "when a pacticipant has a pact with itself... I wouldn't have believed it unless I'd seen it..." do
before do
td.create_consumer("Foo")
.use_provider("Foo")
.create_consumer_version("1")
.create_pact
end

it "doesn't blow up" do
Service.delete("Foo", "Foo")
end
end
end
end
end
Expand Down

0 comments on commit f31e8df

Please sign in to comment.