File tree 2 files changed +16
-3
lines changed
lib/pact_broker/api/decorators
spec/lib/pact_broker/api/decorators
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -11,18 +11,17 @@ module PactBroker
11
11
module Api
12
12
module Decorators
13
13
class WebhookDecorator < BaseDecorator
14
-
15
14
class WebhookEventDecorator < BaseDecorator
16
15
property :name
17
16
end
18
17
19
18
property :description , getter : lambda { |context | context [ :represented ] . display_description }
20
19
21
- property :consumer , :class => PactBroker ::Domain ::Pacticipant do
20
+ property :consumer , :class => PactBroker ::Domain ::Pacticipant , default : nil do
22
21
property :name
23
22
end
24
23
25
- property :provider , :class => PactBroker ::Domain ::Pacticipant do
24
+ property :provider , :class => PactBroker ::Domain ::Pacticipant , default : nil do
26
25
property :name
27
26
end
28
27
Original file line number Diff line number Diff line change @@ -189,6 +189,20 @@ module Decorators
189
189
expect ( parsed_object . events . first . name ) . to eq PactBroker ::Webhooks ::WebhookEvent ::DEFAULT_EVENT_NAME
190
190
end
191
191
end
192
+
193
+ context "when the decorated object has a consumer/provider but the incoming JSON does not" do
194
+ let ( :webhook ) do
195
+ Domain ::Webhook . new (
196
+ consumer : Domain ::Pacticipant . new ( name : 'consumer' ) ,
197
+ provider : Domain ::Pacticipant . new ( name : 'provider' )
198
+ )
199
+ end
200
+
201
+ it "sets the consumer and provider to nil on the decorated object" do
202
+ expect ( parsed_object . consumer ) . to be nil
203
+ expect ( parsed_object . provider ) . to be nil
204
+ end
205
+ end
192
206
end
193
207
end
194
208
end
You can’t perform that action at this time.
0 commit comments