summaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/email_address_test.rb22
-rw-r--r--test/unit/nickname_test.rb28
-rw-r--r--test/unit/request_handler_test.rb5
3 files changed, 27 insertions, 28 deletions
diff --git a/test/unit/email_address_test.rb b/test/unit/email_address_test.rb
new file mode 100644
index 0000000..6d57a8c
--- /dev/null
+++ b/test/unit/email_address_test.rb
@@ -0,0 +1,22 @@
+require 'test_helper'
+require 'nickserver/email_address'
+
+class EmailAddressTest < Minitest::Test
+
+ def test_domain
+ nick = Nickserver::EmailAddress.new 'nick@test.me'
+ assert nick.domain?('test.me')
+ assert !nick.domain?('est.me')
+ end
+
+ def test_valid
+ nick = Nickserver::EmailAddress.new 'nick@remote.domain'
+ assert nick.valid?
+ end
+
+ def test_invalid
+ nick = Nickserver::EmailAddress.new 'asdf'
+ assert nick.invalid?
+ end
+
+end
diff --git a/test/unit/nickname_test.rb b/test/unit/nickname_test.rb
deleted file mode 100644
index 8681545..0000000
--- a/test/unit/nickname_test.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-require 'test_helper'
-require 'nickserver/nickname'
-
-class NicknameTest < Minitest::Test
-
- def test_local
- nick = Nickserver::Nickname.new 'nick@test.me'
- assert nick.local?
- assert !nick.remote?
- end
-
- def test_remote
- nick = Nickserver::Nickname.new 'nick@remote.domain'
- assert !nick.local?
- assert nick.remote?
- end
-
- def test_valid
- nick = Nickserver::Nickname.new 'nick@remote.domain'
- assert nick.valid?
- end
-
- def test_invalid
- nick = Nickserver::Nickname.new 'asdf'
- assert nick.invalid?
- end
-
-end
diff --git a/test/unit/request_handler_test.rb b/test/unit/request_handler_test.rb
index 7fe766e..ef656f9 100644
--- a/test/unit/request_handler_test.rb
+++ b/test/unit/request_handler_test.rb
@@ -13,6 +13,11 @@ class Nickserver::RequestHandlerTest < Minitest::Test
assert_response status: 500, content: "500 Not a valid address\n"
end
+ def test_missing_domain
+ handle address: ['valid@email.tld']
+ assert_response status: 500, content: "500 HTTP request must include a Host header.\n"
+ end
+
protected
def handle(params = {}, headers = {})