diff options
Diffstat (limited to 'test/unit/nicknym/source_test.rb')
-rw-r--r-- | test/unit/nicknym/source_test.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/unit/nicknym/source_test.rb b/test/unit/nicknym/source_test.rb new file mode 100644 index 0000000..586dc0e --- /dev/null +++ b/test/unit/nicknym/source_test.rb @@ -0,0 +1,33 @@ +require 'test_helper' +require 'nickserver/nicknym/source' + +class NicknymSourceTest < Minitest::Test + + def test_initialization + assert source + end + + def test_available_for_domain + adapter.expect :get, [200, 'dummy body'], + ['https://leap_powered.tld/provider.json'] + assert source.available_for?('leap_powered.tld') + adapter.verify + end + + def test_not_available_for_domain + adapter.expect :get, [404, nil], + ['https://remote.tld/provider.json'] + assert !source.available_for?('remote.tld') + adapter.verify + end + + protected + + def source + Nickserver::Nicknym::Source.new(adapter) + end + + def adapter + @adapter ||= Minitest::Mock.new + end +end |