File tree 2 files changed +28
-1
lines changed
lib/pact/matching_rules/v3
spec/lib/pact/matching_rules/v3
2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ def log_ignored_rules
116
116
if @matching_rules . any?
117
117
@matching_rules . each do | path , rules_hash |
118
118
rules_hash . each do | key , value |
119
- $stderr. puts "WARN: Ignoring unsupported #{ key } #{ value } for path #{ path } " if value . any?
119
+ $stderr. puts "WARN: Ignoring unsupported #{ key } #{ value } for path #{ path } " if value_present? ( value )
120
120
end
121
121
end
122
122
end
@@ -129,6 +129,10 @@ def find_rule(path, key)
129
129
def log_used_rule path , key , value
130
130
@used_rules << [ path , key , value ]
131
131
end
132
+
133
+ def value_present? value
134
+ value . respond_to? ( :any? ) ? value . any? : true
135
+ end
132
136
end
133
137
end
134
138
end
Original file line number Diff line number Diff line change @@ -456,6 +456,29 @@ module V3
456
456
end
457
457
end
458
458
459
+ describe "with a combine key" do
460
+ let ( :expected ) do
461
+ {
462
+ "foo" => "bar"
463
+ }
464
+ end
465
+
466
+ let ( :matching_rules ) do
467
+ {
468
+ "$.foo" => {
469
+ "matchers" => [ { "match" => "type" } ] ,
470
+ "combine" => "AND"
471
+ }
472
+ }
473
+
474
+ end
475
+
476
+ it "logs the ignored rule" do
477
+ allow ( Pact . configuration . error_stream ) . to receive ( :puts )
478
+ expect ( Pact . configuration . error_stream ) . to receive ( :puts ) . with ( "WARN: Ignoring unsupported combine AND for path $['foo']" )
479
+ subject
480
+ end
481
+ end
459
482
end
460
483
end
461
484
end
You can’t perform that action at this time.
0 commit comments