summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/nickserver/invalid_source.rb14
-rw-r--r--lib/nickserver/lookup.rb31
-rw-r--r--test/unit/invalid_source_test.rb16
-rw-r--r--test/unit/lookup_test.rb23
4 files changed, 0 insertions, 84 deletions
diff --git a/lib/nickserver/invalid_source.rb b/lib/nickserver/invalid_source.rb
deleted file mode 100644
index dac245a..0000000
--- a/lib/nickserver/invalid_source.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# This is a dummy source for invalid queries.
-# It simply always returns 500 and "Not a valid address"
-#
-
-module Nickserver
- class InvalidSource
-
- def query(nick)
- yield 500, "Not a valid address"
- end
-
- end
-end
diff --git a/lib/nickserver/lookup.rb b/lib/nickserver/lookup.rb
deleted file mode 100644
index 105e77e..0000000
--- a/lib/nickserver/lookup.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-require 'nickserver/invalid_source'
-
-module Nickserver
- class Lookup
-
- attr_reader :nick
-
- def initialize(nick)
- @nick = nick
- end
-
- def respond_with(responder)
- query do |status, content|
- responder.send_response status: status, content: content
- end
- end
-
- protected
-
- def query(&block)
- source.query nick, &block
- end
-
- def source
- if nick.invalid? then Nickserver::InvalidSource
- elsif nick.local? then Nickserver::Config.local_source
- else Nickserver::Config.remote_source
- end
- end
- end
-end
diff --git a/test/unit/invalid_source_test.rb b/test/unit/invalid_source_test.rb
deleted file mode 100644
index 37a38fc..0000000
--- a/test/unit/invalid_source_test.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-require 'test_helper'
-require 'nickserver/invalid_source'
-
-class Nickserver::InvalidSourceTest < Minitest::Test
-
- def test_query
- adapter.query(nil) do |status, content|
- assert_equal 500, status
- assert_equal "Not a valid address", content
- end
- end
-
- def adapter
- Nickserver::InvalidSource.new
- end
-end
diff --git a/test/unit/lookup_test.rb b/test/unit/lookup_test.rb
deleted file mode 100644
index ac827e0..0000000
--- a/test/unit/lookup_test.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require 'test_helper'
-require 'minitest/mock'
-require 'nickserver/lookup'
-
-class TestLookup < Nickserver::Lookup
-
- def query
- yield 200, 'yeah'
- end
-
-end
-
-class LookupTest < Minitest::Test
-
- def test_responding
- responder = Minitest::Mock.new
- responder.expect :send_response, nil,
- [{status: 200, content: 'yeah'}]
- lookup = TestLookup.new nil
- lookup.respond_with responder
- responder.verify
- end
-end