diff options
| author | mo <mo@mokhan.ca> | 2018-05-07 14:40:22 -0600 |
|---|---|---|
| committer | mo <mo@mokhan.ca> | 2018-05-07 14:40:22 -0600 |
| commit | f7bf39e1872e3d8c7dd72b1756fd2c0891c8d46e (patch) | |
| tree | 5e167d7b9a4e1897057e3173672ef8d06f7be6e6 /test | |
| parent | cd2a8d1908fd472ec6a704e8fd76a13ee969de24 (diff) | |
add test for body.
Diffstat (limited to 'test')
| -rw-r--r-- | test/net/client_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/net/client_test.rb b/test/net/client_test.rb index 1d06303..d4dee32 100644 --- a/test/net/client_test.rb +++ b/test/net/client_test.rb @@ -43,6 +43,19 @@ class Net::Hippie::ClientTest < Minitest::Test assert_equal response.class, Net::HTTPCreated end + def test_get_with_body + uri = URI.parse('https://haveibeenpwned.com/api/breaches') + body = { 'hello' => 'world' } + WebMock.stub_request(:get, uri.to_s) + .with(body: body.to_json) + .to_return(status: 201, body: {}.to_json) + + response = subject.get(uri, body: body) + + refute_nil response + assert_equal response.class, Net::HTTPCreated + end + def test_post VCR.use_cassette("post_breaches") do uri = URI.parse('https://haveibeenpwned.com/api/breaches') |
