thoughtworks/pacto — pull request #64 by maxlinc (2013-11-18 15:01:42+00:00)
Title: rspec matchers

Resolves #63.

Adds the following rspec matchers:

```ruby
# high-level
expect(Pacto).to_not have_failed_validations
expect(Pacto).to_not have_unmatched_requests

# fine-grained
# have_validated w/ fluent interface
expect(Pacto).to have_validated(:get, 'http://dummyprovider.com/hello')
expect(Pacto).to have_validated(:get, 'http://dummyprovider.com/hello').with(:headers => {'Accept' => 'application/json'})
expect(Pacto).to have_validated(:get, 'http://dummyprovider.com/hello').against_contract(/simple_contract.json/)
```

Note 1: I'm matching contract's with a regex against the file location. Ideally I'd match them against a nickname defined in the Contract, but I didn't want to change the Contract format as part of this PR. So I'd rather have something like `against_contract 'SimpleService'`, then `against_contract /simple_contract.json/`.

Note 2: I modeled the ValidationRegistry class after WebMock's *Registry classes instead of current Pacto's ContractRepository. I think they're serving similar purposes, and it would be good to refactor the ContractRepository to match this style.