Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

New RSpec matcher (have_investigated) #134

Merged
merged 3 commits into from
Jul 10, 2014
Merged

New RSpec matcher (have_investigated) #134

merged 3 commits into from
Jul 10, 2014

Conversation

maxlinc
Copy link
Collaborator

@maxlinc maxlinc commented Jul 10, 2014

This adds the have_investigated matcher, which is a more "Pacto-idiomatic" version of have_validated. The difference is that have_investigated matches contracts first, not request patterns, and has more flexibility and better error messages as you apply more and more specific filters.

E.g.:

expect(Pacto).to have_investigated('Echo').with_request(body: hash_including('foo' => 'bar'))
expect(Pacto).to have_investigated('Echo').with_response(body: /foo.*bar/)

You could also write that as a single line if you want to make sure it's for the request and response on the same interaction:

expect(Pacto).to have_investigated('Echo').with_request(body: hash_including('foo' => 'bar')).with_response(body: /foo.*bar/)

Might be possible to simplify further and provide a nice API w/ rspec3, but not sure about keeping it rspec2 compatible.

@coveralls
Copy link

Coverage Status

Coverage decreased (-3.62%) when pulling 17fc2ad on forensics into b061db5 on master.

maxlinc added a commit that referenced this pull request Jul 10, 2014
New RSpec matcher (have_investigated)
@maxlinc maxlinc merged commit bfc0016 into master Jul 10, 2014
@maxlinc maxlinc deleted the forensics branch July 10, 2014 23:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants