Allowing regex to be used for hash matching #81

Closed
wants to merge 1 commit into
from

2 participants

@GBH

Something I'm testing generates a random value that is being used in the request. Can't really intercept it or capture. So I added ability to do matching using regex:

assert_requested :post, "http://www.example.com", :body => {:a => \^\w{5}$\, :b => {:c => \^\d{3}$\}}

I changed how hashes are being compared to use ===
So 'abc' === 'abc' works same as \^\w{3}$\ === 'abc'

@jcf
Collaborator

I like this bit of functionality and think it could be a nice feature to add to WebMock's tool belt.

What are your thoughts on renaming some of the locals for the sake of readability? I've pushed a commit (@017e7ac) to bblimke/gbh-matching_hashes with my idea. I've also added some yardoc to the method.

Let me know your thoughts.

@GBH

I think this is great. Hopefully it will be merged in eventually.

@jcf
Collaborator
@GBH

As long as functionality is there, you can change whatever makes sense. Thanks!

@jcf
Collaborator

Applied to master in @70667d0. Thanks Oleg.

@jcf jcf closed this May 18, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment