name: au.com.dius:pact-jvm-consumer-specs2_2.11
description: 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 += &amp;quot;au.com.dius&amp;quot; %% &amp;quot;pact-jvm-consumer-specs2&amp;quot; % &amp;quot;3.2.11&amp;quot; ``` or if you are using Gradle: ```groovy dependencies { testCompile &amp;quot;au.com.dius:pact-jvm-consumer-specs2_2.11:3.2.11&amp;quot; } ``` __*Note:*__ `PactSpec` requires spec2 3.x. Also, for spray users there&amp;apos;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 = &amp;quot;My Consumer&amp;quot; val provider = &amp;quot;My Provider&amp;quot; override def is = uponReceiving(&amp;quot;a request for foo&amp;quot;) .matching(path = &amp;quot;/foo&amp;quot;) .willRespondWith(body = &amp;quot;{}&amp;quot;) .withConsumerTest { providerConfig =&amp;gt; Await.result(ConsumerService(providerConfig.url).simpleGet(&amp;quot;/foo&amp;quot;), Duration(1000, MILLISECONDS)) must beEqualTo(200, Some(&amp;quot;{}&amp;quot;)) } } ``` This spec will be run along with the rest of your specs2 unit tests and will output your pact json to ``` /target/pacts/&amp;lt;Consumer&amp;gt;_&amp;lt;Provider&amp;gt;.json ``` 
license_spdx: Apache-2.0
version: 3.5.15
spec_version: 1.0
download_url: https://repo1.maven.org/maven2/au/com/dius/pact-jvm-consumer-specs2_2.11/3.5.15/pact-jvm-consumer-specs2_2.11-3.5.15.jar
home_url: https://github.com/DiUS/pact-jvm
news_url: https://libraries.io/maven/au.com.dius:pact-jvm-consumer-specs2_2.11/versions.atom
date: 2018-04-22
about_resource: NONE
libraries_io_url: https://libraries.io/maven/au.com.dius:pact-jvm-consumer-specs2_2.11?number=3.5.15
vcs_tool: git
vcs_repository: https://github.com/pact-foundation/pact-jvm
vcs_branch: master
