diff options
| author | mo khan <mo.khan@gmail.com> | 2020-06-12 17:06:14 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-06-12 17:08:46 -0600 |
| commit | 5e327cc4abe45f53918f7afce937c37fa1736a76 (patch) | |
| tree | ec54bd4c8137e05c6330ca485c2eceddc202a93b /test | |
| parent | 35fc5298fd9102cc99a63fa7671d09bfdc53b602 (diff) | |
Create default_client to simplify usage
Diffstat (limited to 'test')
| -rw-r--r-- | test/net/client_test.rb | 4 | ||||
| -rw-r--r-- | test/net/hippie_test.rb | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/test/net/client_test.rb b/test/net/client_test.rb index fa15c4f..9ef6b03 100644 --- a/test/net/client_test.rb +++ b/test/net/client_test.rb @@ -306,8 +306,8 @@ class ClientTest < Minitest::Test end def test_open_timeout_setting - assert_nil subject.open_timeout - @subject.open_timeout = 10 assert_equal subject.open_timeout, 10 + @subject.open_timeout = 5 + assert_equal subject.open_timeout, 5 end end diff --git a/test/net/hippie_test.rb b/test/net/hippie_test.rb index c5a0312..9da4abe 100644 --- a/test/net/hippie_test.rb +++ b/test/net/hippie_test.rb @@ -21,4 +21,17 @@ class HippieTest < Minitest::Test Net::Hippie.verify_mode = OpenSSL::SSL::VERIFY_NONE assert Net::Hippie.verify_mode == OpenSSL::SSL::VERIFY_NONE end + + def test_get_with_retry + uri = URI.parse('https://www.example.org/api/scim/v2/schemas') + WebMock.stub_request(:get, uri.to_s) + .to_timeout.then + .to_timeout.then + .to_timeout.then + .to_return(status: 200, body: { 'success' => 'true' }.to_json) + response = Net::Hippie.get(uri) + refute_nil response + assert_equal Net::HTTPOK, response.class + assert_equal JSON.parse(response.body)['success'], 'true' + end end |
