From 21af9f54b173fae5ebc4a83591e81cda3b1fb272 Mon Sep 17 00:00:00 2001 From: Tomasz Linkowski Date: Mon, 28 Nov 2022 15:12:54 +0100 Subject: [PATCH] refactor: add missing test case for #1347 --- .../pact/core/matchers/MatchingContextSpec.groovy | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/matchers/src/test/groovy/au/com/dius/pact/core/matchers/MatchingContextSpec.groovy b/core/matchers/src/test/groovy/au/com/dius/pact/core/matchers/MatchingContextSpec.groovy index 538e3c3b3f..78f8d2018f 100644 --- a/core/matchers/src/test/groovy/au/com/dius/pact/core/matchers/MatchingContextSpec.groovy +++ b/core/matchers/src/test/groovy/au/com/dius/pact/core/matchers/MatchingContextSpec.groovy @@ -14,6 +14,7 @@ import au.com.dius.pact.core.model.matchingrules.MinMaxTypeMatcher import au.com.dius.pact.core.model.matchingrules.NullMatcher import au.com.dius.pact.core.model.matchingrules.RegexMatcher import au.com.dius.pact.core.model.matchingrules.TypeMatcher +import au.com.dius.pact.core.model.matchingrules.ValuesMatcher import kotlin.Triple import spock.lang.Issue import spock.lang.Specification @@ -291,6 +292,20 @@ class MatchingContextSpec extends Specification { category << [ 'header', 'query', 'metadata' ] } + @Issue('#1347') + def 'values matcher must not cascade'() { + given: + def matchingRules = new MatchingRuleCategory('body') + matchingRules.addRule('$', ValuesMatcher.INSTANCE) + def context = new MatchingContext(matchingRules, true) + + when: + def rules = context.selectBestMatcher(['$', 'id']) + + then: + rules.rules == [] + } + @Issue('#1367') def 'array contains matcher with simple values'() { given: