summaryrefslogtreecommitdiff
path: root/test/unit/email_address_test.rb
blob: 983e979cf468c958d66512e0641f31b4d81a33ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'test_helper'
require 'nickserver/email_address'

class EmailAddressTest < Minitest::Test
  def test_domain
    nick = Nickserver::EmailAddress.new 'nick@test.me'
    assert_equal 'test.me', nick.domain
    assert nick.domain?('test.me')
    assert !nick.domain?('est.me')
  end

  def test_local_part
    nick = Nickserver::EmailAddress.new 'nick@test.me'
    assert_equal 'nick', nick.local_part
  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