summaryrefslogtreecommitdiff
path: root/test/integration/dispatcher_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/dispatcher_test.rb')
-rw-r--r--test/integration/dispatcher_test.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/integration/dispatcher_test.rb b/test/integration/dispatcher_test.rb
index 60d252b..4ec823b 100644
--- a/test/integration/dispatcher_test.rb
+++ b/test/integration/dispatcher_test.rb
@@ -15,16 +15,12 @@ class Nickserver::DispatcherTest < Minitest::Test
def test_missing_domain
handle address: ['valid@email.tld']
- assert_response status: 500, content: "500 HTTP request must include a Host header.\n"
+ assert_response_from_hkp
end
def test_email_from_hkp
handle address: ['valid@email.tld'], headers: { "Host" => "http://nickserver.me" }
- source = Minitest::Mock.new
- source.expect :query, Nickserver::Response.new(200, "fake content"), [Nickserver::EmailAddress]
- Nickserver::Hkp::Source.stub :new, source do
- assert_response status: 200, content: "200 fake content"
- end
+ assert_response_from_hkp
end
def test_fingerprint_to_short
@@ -62,6 +58,14 @@ class Nickserver::DispatcherTest < Minitest::Test
responder.verify
end
+ def assert_response_from_hkp
+ source = Minitest::Mock.new
+ source.expect :query, Nickserver::Response.new(200, "fake content"), [Nickserver::EmailAddress]
+ Nickserver::Hkp::Source.stub :new, source do
+ assert_response status: 200, content: "200 fake content"
+ end
+ end
+
def dispatcher
Nickserver::Dispatcher.new responder
end