Skip to content
Olia Kremmyda edited this page Feb 23, 2018 · 3 revisions

Stub a request

stub_http_request(method, uri)
stub_request(method, uri)

More details can be found in README file

Create new pattern

a_request(method, uri)
request(method, uri)

Assertions

assert_requested(method_and_options, block)
assert_not_requested(method_and_options, block)
refute_requested(method_and_options, block)

ArgumentMatchers

hash_including(args)
hash_excluding(args)

Similar to RSpec::Mocks::ArgumentMatchers#hash_including()

Matches a hash that includes the specified key(s) or key/value pairs.

Ignores any additional keys.

Example:

 object.should_receive(:message).with(hash_including(:key => val))
 object.should_receive(:message).with(hash_including(:key))
 object.should_receive(:message).with(hash_including(:key, :key2 => val2))

Cleanup

remove_request_stub(stub)