Download pact-jvm-consumer-specs2_2.11 JAR file with all dependencies
pact-jvm-consumer-specs2_2.11 from group au.com.dius (version 3.2.2)
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.11"
```
or if you are using Gradle:
```groovy
dependencies {
testCompile "au.com.dius:pact-jvm-consumer-specs2_2.11:3.2.11"
}
```
__*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
```
0 downloads
Artifact pact-jvm-consumer-specs2_2.11
Group au.com.dius
Version 3.2.2
Last update 17. January 2016
Tags: body using client root test consumer willrespondwith must dependency wrapper beequalto request import along librarydependencies milliseconds alongside groovy extends providerconfig class here code requires project matching pact await http override will called gradle rest pactspec example output some this examplepactspec 1000 spec result consumerservice bindings simple uponreceiving line build scala withconsumertest author tests dependencies json path dispatch note define specs2 with your into provider spec2 testcompile folder unit duration simpleget source service library specification target usage first pacts dius found
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 10
Dependencies kotlin-stdlib-jdk8, kotlin-reflect, slf4j-api, groovy-all, kotlin-logging, scala-library, scala-logging_2.11, pact-jvm-consumer_2.11, specs2-core_2.11, async-http-client,
There are maybe transitive dependencies!
Group au.com.dius
Version 3.2.2
Last update 17. January 2016
Tags: body using client root test consumer willrespondwith must dependency wrapper beequalto request import along librarydependencies milliseconds alongside groovy extends providerconfig class here code requires project matching pact await http override will called gradle rest pactspec example output some this examplepactspec 1000 spec result consumerservice bindings simple uponreceiving line build scala withconsumertest author tests dependencies json path dispatch note define specs2 with your into provider spec2 testcompile folder unit duration simpleget source service library specification target usage first pacts dius found
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 10
Dependencies kotlin-stdlib-jdk8, kotlin-reflect, slf4j-api, groovy-all, kotlin-logging, scala-library, scala-logging_2.11, pact-jvm-consumer_2.11, specs2-core_2.11, async-http-client,
There are maybe transitive dependencies!
Page 1 from 1 (items total 1)