Group / Artifact / Version / pact-jvm-consumer-specs2_2.10 / 2.4.20
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 += "" %% "pact-jvm-consumer-specs2" % "3.2.2" ``` or if you are using Gradle: ```groovy dependencies { testCompile "" } ``` __*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:!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 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 ```
Last modified2018-04-14 11:49:33 UTC
Repository URL
Packaging jar
POM File View
Effective POM File View
Dependency tag
<dependency org="" name="pact-jvm-consumer-specs2_2.10" rev="2.4.20" />
@Grapes(@Grab(group='', module='pact-jvm-consumer-specs2_2.10', version='2.4.20'))
compile ''
libraryDependencies += "" % "pact-jvm-consumer-specs2_2.10" % "2.4.20"
Repository tag