Contract Testing with Pact #15
var provider: MockService! | |
var client: BootstrapClient! | |
beforeEach { | |
provider = MockService(provider: "consumer-mobile-bff", consumer: "consumer-ios") | |
client = BootstrapClient(baseUrl: provider!.baseUrl) | |
} | |
it("should fetch bootstrap information from provider") { | |
provider!.given("default") | |
.uponReceiving("Fetching application bootstrap information") | |
.withRequest(method: .GET, path: "/v1/bootstrap") | |
.willRespondWith(status:200, headers: ["Content-Type": "application/json"], body: | |
{"version": {"minimum_version": "1.0", "current_version": "2.0"}} | |
) | |
provider!.run { (testComplete) -> Void in | |
client!.bootstrap { (response) in | |
expect(response.version.minimumVersion).to(equal("1.0")) | |
expect(response.version.currentVersion).to(equal("2.0")) | |
testComplete() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment