Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include documentation RegEx hash_including matcher #898

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ChrisBr
Copy link

@ChrisBr ChrisBr commented Jul 31, 2020

I just learned about this really cool feature that you can match agains a RegEx in hash_including so I added some documentation for it.

stub_request(:post, "www.example.com").
  with(body: hash_including(id: /\d/))

RestClient.post('www.example.com', "id=1",
:content_type => 'application/x-www-form-urlencoded')    # ===> Success

@bblimke
Copy link
Owner

bblimke commented Sep 11, 2020

@ChrisBr this only works if we are inside RSpec. WebMock has own limited implementation of hash_including in case hash_including is not already available. Perhaps it's better to mention that in the documentation, that people can take advantage of all RSpec's hash_including goodies as long as it's Rspec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants