webmock icon indicating copy to clipboard operation
webmock copied to clipboard

Error checking doesn't recognize hashes and provide the intended help

Open jakerobb opened this issue 2 years ago • 1 comments

If you pass a hash as a mocked response, the assert_valid_body! method fails to recognize it as such, and so you get the less helpful version of the error message.

I believe that this line should be changed from:

      if @body.class.is_a?(Hash)

to:

      if @body.is_a?(Hash)

@body is a Hash, but @body.class is a Class. 🙂

jakerobb avatar Mar 14 '23 19:03 jakerobb

Thank you @jakerobb

This is now fixed in 3.21.2 release.

bblimke avatar Feb 20 '24 04:02 bblimke