Repository navigation
-
Show request body differences when
assert_requestedor an RSpec request expectation fails (#825)If your test expects
POST /orderswith"total": 10in the JSON body and the request omits that field, the failure message now showstotal: expected 10, but the field was missing. Previously, you had to find the difference in the request history. WebMock shows a short diff when one distinct request matches the method and URL and its body explains the mismatch.For multiline XML and plain text, the diff shows line numbers, with
-for expected lines and+for lines actually sent. This uses thediff-lcsgem. Unregistered request errors previously printed JSON differences as arrays such as["+", "total", 10]. They now use the same wording and skip stubs with a different method or URL. When several JSON fields differ, both messages show the expected and recorded bodies if that takes no more space than listing the changes.Thanks to Adrian1707 and odinhb for the examples.
-
Fix
IOError: ungetbyte failedwhen matching large file uploadsWith Curb, Patron or em-http-request, even calling
file.eof?before an upload could trigger the error and leave the file at the end. WebMock now matches and records the bytes from the current position and leaves the file ready for the HTTP client to read.