thoughtworks/pacto — pull request #26 by raquelguimaraes (2013-09-24 20:06:13+00:00)
Title: Pacto request matching (looking up a registered Contract that matches a request signature)

**This is WIP, don't merge until we remove this message!**

Since we will have multiple contracts active we believe we need a way to look up the contract that best matches a request. WebMock handles this for stubbing and it might just be associating a contract with a callback, but we may need an independent lookup for use with IntegrationContractTests.

(Obviously pseudo-tests - please don't make cucumber look like this!)

As a tester using Pacto
I want Pacto to find Contracts matching a request signature
So I have the flexibility to use validate Contracts via callbacks that only give me request/response signature.

Scenario: Exactly one match
Given I have registered a contract for "GET /hello"
When I lookup a Contract for the "GET /hello" request signature
Then I should receive the contract

Scenario: No match
Given I have registered a contract for "GET /world"
When I lookup a Contract for the "GET /hello" request signature
Then I should not receive a contract

Scenario: Multiple matches
Given I have registered a contract for "GET /stuff"
And I have registered a contract for "GET /stuff" with different headers
When I lookup a Contract for the "GET /stuff" request signature
Then I should receive either matching contract