summaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/nicknym/source_test.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/unit/nicknym/source_test.rb b/test/unit/nicknym/source_test.rb
index f8c9b60..b17f22b 100644
--- a/test/unit/nicknym/source_test.rb
+++ b/test/unit/nicknym/source_test.rb
@@ -1,4 +1,6 @@
require 'test_helper'
+require 'http'
+require 'json'
require 'nickserver/nicknym/source'
require 'nickserver/email_address'
@@ -20,6 +22,11 @@ class NicknymSourceTest < Minitest::Test
refute available_on?(200, 'blablabla')
end
+ # adapter rescues name resolution errors and returns nothing
+ def test_not_available_without_response
+ refute available_on?
+ end
+
def test_proxy_successful_query
assert proxies_query_response?(200, 'dummy body')
end
@@ -39,9 +46,9 @@ class NicknymSourceTest < Minitest::Test
adapter.verify
end
- def available_on?(status = 0, body = nil)
- adapter.expect :get, [status, body],
- ['https://remote.tld/provider.json']
+ def available_on?(*args)
+ adapter.expect :get, args,
+ ['https://remote.tld/provider.json', Hash]
available = source.available_for?('remote.tld')
adapter.verify
return available