Skip to content

Commit

Permalink
fix: ensure pacticipant name is retained when updating with PUT
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jun 3, 2022
1 parent ef7f014 commit eeac47c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/pact_broker/pacticipants/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ def update(pacticipant_name, pacticipant)
pacticipant.save
end

def replace(_pacticipant_name, open_struct_pacticipant)
def replace(pacticipant_name, open_struct_pacticipant)
PactBroker::Domain::Pacticipant.new(
name: pacticipant_name,
display_name: open_struct_pacticipant.display_name,
repository_url: open_struct_pacticipant.repository_url,
repository_name: open_struct_pacticipant.repository_name,
Expand Down
1 change: 1 addition & 0 deletions spec/lib/pact_broker/pacticipants/repository_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ module Pacticipants
subject { Repository.new.replace("Bar", OpenStruct.new(main_branch: "bar", repository_url: "new_url")) }

it "replaces the pacticipant" do
expect(subject.name).to eq "Bar"
expect(subject.main_branch).to eq "bar"
expect(subject.repository_namespace).to eq nil
expect(subject.display_name).to eq "display_name"
Expand Down

0 comments on commit eeac47c

Please sign in to comment.