au.com.dius:pact-jvm-consumer-specs2_2.11:3.5.0-beta.3

Group / Artifact / Version au.com.dius / pact-jvm-consumer-specs2_2.11 / 3.5.0-beta.3
Namepact-jvm-consumer-specs2_2.11
Descriptionpact-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/_.json ```
Last modified2017-02-05 05:55:44 UTC
URL https://github.com/DiUS/pact-jvm
Repository URL https://oss.sonatype.org/content/repositories/releases/au/com/dius/pact-jvm-consumer-specs2_2.11/3.5.0-beta.3/
Packaging jar
POM File View
Effective POM File View
Dependency tag
<dependency>
  <groupId>au.com.dius</groupId>
  <artifactId>pact-jvm-consumer-specs2_2.11</artifactId>
  <version>3.5.0-beta.3</version>
</dependency>
'au.com.dius:pact-jvm-consumer-specs2_2.11:jar:3.5.0-beta.3'
<dependency org="au.com.dius" name="pact-jvm-consumer-specs2_2.11" rev="3.5.0-beta.3" />
@Grapes(@Grab(group='au.com.dius', module='pact-jvm-consumer-specs2_2.11', version='3.5.0-beta.3'))
compile 'au.com.dius:pact-jvm-consumer-specs2_2.11:3.5.0-beta.3'
libraryDependencies += "au.com.dius" % "pact-jvm-consumer-specs2_2.11" % "3.5.0-beta.3"
Repository tag
  <repository>
    <id>central</id>
    <url>http://repo1.maven.org/maven2/</url>
  </repository>
  <repository>
    <id>sonatype-releases</id>
    <url>https://oss.sonatype.org/content/repositories/releases/</url>
  </repository>
  <repository>
    <id>sonatype-staging</id>
    <url>https://oss.sonatype.org/content/repositories/staging/</url>
  </repository>
  <repository>
    <id>spring-milestones</id>
    <url>http://repo.spring.io/libs-milestone/</url>
  </repository>
  <repository>
    <id>spring-plugin-releases</id>
    <url>http://repo.spring.io/plugins-release/</url>
  </repository>
  <repository>
    <id>spring-releases</id>
    <url>http://repo.spring.io/libs-release-remote/</url>
  </repository>
Packages

au.com.dius.pact.consumer

au.com.dius.pact.consumer.specs2