Last active
February 25, 2021 22:32
-
-
Save danhodge/f70887ab609883e8edefb9de124ad646 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Excon exposes defaults for injecting configuration parameters | |
Excon.defaults[:mock] = true | |
Excon.defaults.delete(:mock) | |
# Excon stubbing | |
# first parameter - Hash of expected request attributes (all are optional) | |
# second parameter - Hash of response attributes | |
# if second parameter is omitted, a block can be provided a Proc object | |
Excon.stub({ method: :post, path: exp_path, headers: exp_headers, query: exp_query, body: exp_body }, { status: 200 }) | |
# Or, just use webmock directly | |
stub_request(:post, url).with(body: "", headers: {}).to_return(status: 200, body: "") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment