Skip to content

Commit 309f0d0

Browse files
committed
fix: pass pact spec to matching rules extract func
note matching rules are written incorrectly current behaviour ```json "matchingRules": { "$.body.company": { "matchers": [ { "match": "type" } ] }, "$.body.factories": { "matchers": [ { "min": 1 } ] }, "$.body.factories[*].*": { "matchers": [ { "match": "type" } ] } } ``` expected behaviour ```json "matchingRules": { "body":{ "$.company": { "matchers": [ { "match": "type" } ] }, "$.factories": { "matchers": [ { "min": 1 } ] }, "$.factories[*].*": { "matchers": [ { "match": "type" } ] } } } ```
1 parent 61c04bf commit 309f0d0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/pact/consumer_contract/request_decorator.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def include_matching_rules?
7575
end
7676

7777
def with_matching_rules hash
78-
matching_rules = Pact::MatchingRules.extract request.to_hash
78+
matching_rules = Pact::MatchingRules.extract(request.to_hash, pact_specification_version: Pact::SpecificationVersion.new(pact_specification_version))
7979
return hash if matching_rules.empty?
8080
hash.merge(matchingRules: matching_rules)
8181
end

lib/pact/consumer_contract/response_decorator.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def include_matching_rules?
3434
end
3535

3636
def with_matching_rules hash
37-
matching_rules = Pact::MatchingRules.extract hash
37+
matching_rules = Pact::MatchingRules.extract(hash, pact_specification_version: Pact::SpecificationVersion.new(pact_specification_version))
3838
example = Pact::Reification.from_term hash
3939
return example if matching_rules.empty?
4040
example.merge(matchingRules: matching_rules)

0 commit comments

Comments
 (0)