Mock
Handle returned by Server.mock. Represents every
matcher/response item registered by a single .mock() call, whether that
was one item or several — its methods act on all of them together.
Methods
received
Returns every request matched by any of this handle's mocks, in the order received.
Returns
Array of Request.
server.mock
- method: POST
path: /users
respond:
status: 201
do |handle|
http.post (server.url / "/users") body: hello
let reqs = handle.received()
assert_eq $reqs.len 1
assert_eq $reqs[0].method "POST"
verify
Re-checks the expect: condition of every item registered by this handle
(if any were given) against requests received so far.
Returns
nil if all are satisfied (or none had expect:)
Errors
Raises if any item's expect: is unsatisfied, same as at scoped-block exit
— the message lists every unsatisfied item, one per line.
unmount
Unmounts every mock this handle registered. They stop matching further requests. Has no effect on items already unmounted.
Returns
nil