-
-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: previous provider states must not be copied over to new interact…
…ions #497
- Loading branch information
Ronald Holshausen
committed
Jul 31, 2021
1 parent
08c639e
commit 43ec874
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
consumer/src/test/groovy/au/com/dius/pact/consumer/ConsumerPactBuilderSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package au.com.dius.pact.consumer | ||
|
||
import au.com.dius.pact.core.model.ProviderState | ||
import spock.lang.Issue | ||
import spock.lang.Specification | ||
|
||
class ConsumerPactBuilderSpec extends Specification { | ||
@Issue('#497') | ||
def 'previous provider states must not be copied over to new interactions'() { | ||
given: | ||
def pact = ConsumerPactBuilder.consumer('test') | ||
.hasPactWith('provider') | ||
.given('greeting', [name: 'world']) | ||
.uponReceiving('GET /hello') | ||
.path('/hello') | ||
.method('POST') | ||
.willRespondWith() | ||
.status(200) | ||
.uponReceiving('GET /hello-user') | ||
.path('/hello-user') | ||
.method('POST') | ||
.willRespondWith() | ||
.status(200) | ||
.toPact() | ||
|
||
expect: | ||
pact.interactions[0].providerStates == [new ProviderState('greeting', [name: 'world'])] | ||
pact.interactions[1].providerStates == [] | ||
} | ||
} |