File tree 2 files changed +14
-0
lines changed
lib/pact_broker/api/decorators
spec/lib/pact_broker/api/decorators
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,13 @@ def to_hash(options)
26
26
end
27
27
28
28
def deployable
29
+ return nil if lines . empty?
29
30
return nil if lines . any? { |line | line [ :success ] . nil? }
30
31
lines . any? && lines . all? { |line | line [ :success ] }
31
32
end
32
33
33
34
def reason
35
+ return "No results matched the given query" if lines . empty?
34
36
case deployable
35
37
when true then "All verification results are published and successful"
36
38
when false then "One or more verifications have failed"
Original file line number Diff line number Diff line change @@ -160,6 +160,18 @@ module Decorators
160
160
expect ( parsed_json [ :summary ] [ :reason ] ) . to match /have failed/
161
161
end
162
162
end
163
+
164
+ context "when there are no results" do
165
+ let ( :lines ) { [ ] }
166
+
167
+ it "has a deployable flag of false" do
168
+ expect ( parsed_json [ :summary ] [ :deployable ] ) . to be nil
169
+ end
170
+
171
+ it "has an explanation" do
172
+ expect ( parsed_json [ :summary ] [ :reason ] ) . to match /No results/
173
+ end
174
+ end
163
175
end
164
176
end
165
177
end
You can’t perform that action at this time.
0 commit comments