@@ -228,16 +228,28 @@ module Webhooks
228
228
subject { Repository . new . update_by_uuid ( uuid , new_webhook ) }
229
229
230
230
it "updates the webhook" do
231
- updated_webhook = subject
232
- expect ( updated_webhook . uuid ) . to eq uuid
233
- expect ( updated_webhook . request . method ) . to eq 'GET'
234
- expect ( updated_webhook . request . url ) . to eq 'http://example.com'
235
- expect ( updated_webhook . request . body ) . to eq 'foo'
236
- expect ( updated_webhook . request . headers ) . to eq 'Content-Type' => 'text/plain'
237
- expect ( updated_webhook . request . username ) . to eq nil
238
- expect ( updated_webhook . request . password ) . to eq nil
239
- expect ( updated_webhook . events . first . name ) . to eq 'something_else'
240
- expect ( updated_webhook . consumer . name ) . to eq "Foo2"
231
+ expect ( subject . uuid ) . to eq uuid
232
+ expect ( subject . request . method ) . to eq 'GET'
233
+ expect ( subject . request . url ) . to eq 'http://example.com'
234
+ expect ( subject . request . body ) . to eq 'foo'
235
+ expect ( subject . request . headers ) . to eq 'Content-Type' => 'text/plain'
236
+ expect ( subject . request . username ) . to eq nil
237
+ expect ( subject . request . password ) . to eq nil
238
+ expect ( subject . events . first . name ) . to eq 'something_else'
239
+ expect ( subject . consumer . name ) . to eq "Foo2"
240
+ end
241
+
242
+ context "when the updated params do not contain a consumer or provider" do
243
+ let ( :new_webhook ) do
244
+ PactBroker ::Domain ::Webhook . new (
245
+ events : [ new_event ] ,
246
+ request : new_request
247
+ )
248
+ end
249
+
250
+ it "removes the existing consumer or provider" do
251
+ expect ( subject . consumer ) . to be nil
252
+ end
241
253
end
242
254
end
243
255
0 commit comments