pact-jvm-consumer-specs2_2.10
· pact-jvm-consumer-specs2
========================
## Specs2 Bindings for the pact-jvm library
## Dependency
In the root folder of your project in build.sbt add the line:
```scala
libraryDependencies += "au.com.dius" %% "pact-jvm-consumer-specs2" % "3.2.2"
```
or if you are using Gradle:
```groovy
dependencies {
testCompile "au.com.dius:pact-jvm-consumer-specs2_2.11:3.2.2"
}
```
__*Note:*__ `PactSpec` requires spec2 3.x. Also, for spray users there's an incompatibility between specs2 v3.x and spray.
Follow these instructions to resolve that problem: https://groups.google.com/forum/#!msg/spray-user/2T6SBp4OJeI/AJlnJuAKPRsJ
## Usage
To author a test, mix `PactSpec` into your spec
First we define a service client called `ConsumerService`. In our example this is a simple wrapper for `dispatch`, an HTTP client. The source code can be found in the test folder alongside the `ExamplePactSpec`.
Here is a simple example:
```
import au.com.dius.pact.consumer.PactSpec
class ExamplePactSpec extends Specification with PactSpec {
val consumer = "My Consumer"
val provider = "My Provider"
override def is = uponReceiving("a request for foo")
.matching(path = "/foo")
.willRespondWith(body = "{}")
.withConsumerTest { providerConfig =>
Await.result(ConsumerService(providerConfig.url).simpleGet("/foo"), Duration(1000, MILLISECONDS)) must beEqualTo(200, Some("{}"))
}
}
```
This spec will be run along with the rest of your specs2 unit tests and will output your pact json to
```
/target/pacts/<Consumer>_<Provider>.json
```
Choose a version of au.com.dius : pact-jvm-consumer-specs2_2.10 to add to Maven or Gradle - Latest Versions:
Latest Stable: 2.4.20
Latest Release Candidate: 2.0-RC5
All Versions
Choose a version of au.com.dius : pact-jvm-consumer-specs2_2.10 to add to Maven or Gradle - All Versions:
Version
Vulnerabilities
Updated
2.4.x
pact-jvm-consumer-specs2_2.10-2.4.20
pact-jvm-consumer-specs2_2.10-2.4.19
pact-jvm-consumer-specs2_2.10-2.4.18
pact-jvm-consumer-specs2_2.10-2.4.17
pact-jvm-consumer-specs2_2.10-2.4.16
pact-jvm-consumer-specs2_2.10-2.4.15
pact-jvm-consumer-specs2_2.10-2.4.14
pact-jvm-consumer-specs2_2.10-2.4.13
pact-jvm-consumer-specs2_2.10-2.4.12
pact-jvm-consumer-specs2_2.10-2.4.11
pact-jvm-consumer-specs2_2.10-2.4.10
pact-jvm-consumer-specs2_2.10-2.4.9
pact-jvm-consumer-specs2_2.10-2.4.8
pact-jvm-consumer-specs2_2.10-2.4.7
pact-jvm-consumer-specs2_2.10-2.4.6
pact-jvm-consumer-specs2_2.10-2.4.5
pact-jvm-consumer-specs2_2.10-2.4.4
pact-jvm-consumer-specs2_2.10-2.4.3
pact-jvm-consumer-specs2_2.10-2.4.2
pact-jvm-consumer-specs2_2.10-2.4.1
pact-jvm-consumer-specs2_2.10-2.4.0
2.3.x
pact-jvm-consumer-specs2_2.10-2.3.3
pact-jvm-consumer-specs2_2.10-2.3.2
pact-jvm-consumer-specs2_2.10-2.3.1
pact-jvm-consumer-specs2_2.10-2.3.0
2.2.x
pact-jvm-consumer-specs2_2.10-2.2.15
pact-jvm-consumer-specs2_2.10-2.2.14
pact-jvm-consumer-specs2_2.10-2.2.13
pact-jvm-consumer-specs2_2.10-2.2.12
pact-jvm-consumer-specs2_2.10-2.2.11
pact-jvm-consumer-specs2_2.10-2.2.10
pact-jvm-consumer-specs2_2.10-2.2.9
pact-jvm-consumer-specs2_2.10-2.2.8
pact-jvm-consumer-specs2_2.10-2.2.7
pact-jvm-consumer-specs2_2.10-2.2.6
pact-jvm-consumer-specs2_2.10-2.2.5
pact-jvm-consumer-specs2_2.10-2.2.4
pact-jvm-consumer-specs2_2.10-2.2.3
pact-jvm-consumer-specs2_2.10-2.2.2
pact-jvm-consumer-specs2_2.10-2.2.1
pact-jvm-consumer-specs2_2.10-2.2.0
2.1.x
pact-jvm-consumer-specs2_2.10-2.1.13
pact-jvm-consumer-specs2_2.10-2.1.12
pact-jvm-consumer-specs2_2.10-2.1.11
pact-jvm-consumer-specs2_2.10-2.1.10
pact-jvm-consumer-specs2_2.10-2.1.9
pact-jvm-consumer-specs2_2.10-2.1.8
pact-jvm-consumer-specs2_2.10-2.1.7
pact-jvm-consumer-specs2_2.10-2.1.6
pact-jvm-consumer-specs2_2.10-2.1.5
pact-jvm-consumer-specs2_2.10-2.1.4
pact-jvm-consumer-specs2_2.10-2.1.3
pact-jvm-consumer-specs2_2.10-2.1.2
pact-jvm-consumer-specs2_2.10-2.1.1
pact-jvm-consumer-specs2_2.10-2.1.0
2.0.x
pact-jvm-consumer-specs2_2.10-2.0.9
pact-jvm-consumer-specs2_2.10-2.0.8
pact-jvm-consumer-specs2_2.10-2.0.7
pact-jvm-consumer-specs2_2.10-2.0.6
pact-jvm-consumer-specs2_2.10-2.0.5
pact-jvm-consumer-specs2_2.10-2.0.4
pact-jvm-consumer-specs2_2.10-2.0.3
pact-jvm-consumer-specs2_2.10-2.0.2
pact-jvm-consumer-specs2_2.10-2.0.1
pact-jvm-consumer-specs2_2.10-2.0.0
2.0
pact-jvm-consumer-specs2_2.10-2.0-RC5
pact-jvm-consumer-specs2_2.10-2.0-RC4
pact-jvm-consumer-specs2_2.10-2.0-RC3
How to add a dependency to Maven
Add the following au.com.dius : pact-jvm-consumer-specs2_2.10 maven dependency to the pom.xml file with your favorite IDE (IntelliJ / Eclipse / Netbeans):