Sha256: 89361e995edce16ddd2e0170b19a691e912413eabf51c279572a7eaf3dffa686

Contents?: true

Size: 1.71 KB

Versions: 4

Compression:

Stored size: 1.71 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'

class AddressTest < Test::Unit::TestCase
    fixtures :mailinglists, :users, :addresses_mailinglists, :addresses,
        :domains, :sys_configs

    def test_parse_1
        assert_equal [ 'address1@foo.test', 'Address One'],
            Address.parse('address1@foo.test (Address One)')
        assert_equal [ 'address1@foo.test', 'Address One'],
            Address.parse('Address One <address1@foo.test>')
        assert_equal [ 'address1@foo.test', '"Address 1. One"'],
            Address.parse('"Address 1. One" <address1@foo.test>')
        assert_equal [ 'address1@foo.test', nil],
            Address.parse('address1@foo.test')
        assert_equal [ 'address1', nil ],
            Address.parse('address1')
    end

    def test_proxyaddress_find_internal
        assert a=Address.find(1)
        assert_equal 'testuser@test.domain', a.proxyaddress
        assert a=Address.find(3)
        assert_equal nil, a.proxyaddress
    end

    def test_proxyaddress_find_external
        assert_equal 'testuser@test.domain',
            Address.proxyaddress('address1@foo.test'),
            'an address with a proxy address'
        assert_equal nil, 
            Address.proxyaddress('addressnonactive@foo.test'),
            'an address it knows about without a proxy address'
        assert_equal nil,
            Address.proxyaddress('addressnonexistent@foo.test'),
            'an address it doesn\'t know about without a proxy address'
    end

    def test_string_conversion
        assert_equal 'address1@foo.test', Address.find(1).to_s
        assert_equal 'address2@foo.test', Address.find(2).to_s
        assert_equal 'addressnonactive@foo.test', Address.find(3).to_s
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sugoi-mail-0.0.2 test/unit/address_test.rb
sugoi-mail-0.0.3 test/unit/address_test.rb
sugoi-mail-0.0.5 test/unit/address_test.rb
sugoi-mail-0.1.0 test/unit/address_test.rb