Sha256: edd8bec25417f365ebd216e2f09ffdb126b752bba4691262e2614ffd4fd0b799

Contents?: true

Size: 1.5 KB

Versions: 145

Compression:

Stored size: 1.5 KB

Contents

require 'test_helper'
require 'vmail/address_quoter'

class AddressQuoterTest < MiniTest::Unit::TestCase
  include Vmail::AddressQuoter

  def setup
    @string = "Bob Smith <bobsmith@gmail.com>, Jones, Rich A. <richjones@gmail.com>"
    @expected = '"Bob Smith" <bobsmith@gmail.com>, "Jones, Rich A." <richjones@gmail.com>'
    @string2 = "Jones, Rich A. <richjones@gmail.com>, Bob Smith <bobsmith@gmail.com>"
    @expected2 = '"Jones, Rich A." <richjones@gmail.com>, "Bob Smith" <bobsmith@gmail.com>'
  end

  def test_quoting
    assert_equal @expected, quote_addresses(@string)  #=> "Bob Smith" <bobsmith@gmail.com>, "Jones, Rich A." <richjones@gmail.com>
    assert_equal @expected2, quote_addresses(@string2)  #=> "Bob Smith" <bobsmith@gmail.com>, "Jones, Rich A." <richjones@gmail.com>
  end
  
  def test_quoting_with_bare_email_address
    string = "richjones@gmail.com"
    assert_equal string, quote_addresses(string)  

    string = "Bob Smith <bobsmith@gmail.com>, Jones, Rich A. <richjones@gmail.com>, peterbaker@gmail.com"
    expected = %q("Bob Smith" <bobsmith@gmail.com>, "Jones, Rich A." <richjones@gmail.com>, peterbaker@gmail.com)
    assert_equal expected, quote_addresses(string)  
  end

  def test_quoting_already_quoted
    string = %q(Bob Smith <bobsmith@gmail.com>, "Jones, Rich A." <richjones@gmail.com>, peterbaker@gmail.com)
    expected = %q("Bob Smith" <bobsmith@gmail.com>, "Jones, Rich A." <richjones@gmail.com>, peterbaker@gmail.com)
    assert_equal expected, quote_addresses(string)  
  end

end

Version data entries

145 entries across 145 versions & 1 rubygems

Version Path
vmail-2.8.7 test/address_quoter_test.rb
vmail-2.8.6 test/address_quoter_test.rb
vmail-2.8.5 test/address_quoter_test.rb
vmail-2.8.4 test/address_quoter_test.rb
vmail-2.8.2 test/address_quoter_test.rb
vmail-2.8.1 test/address_quoter_test.rb
vmail-2.8.0 test/address_quoter_test.rb
vmail-2.7.8 test/address_quoter_test.rb
vmail-2.7.7 test/address_quoter_test.rb
vmail-2.7.6 test/address_quoter_test.rb
vmail-2.7.5 test/address_quoter_test.rb
vmail-2.7.4 test/address_quoter_test.rb
vmail-2.7.3 test/address_quoter_test.rb
vmail-2.7.1 test/address_quoter_test.rb
vmail-2.7.0 test/address_quoter_test.rb
vmail-2.6.9 test/address_quoter_test.rb
vmail-2.6.7 test/address_quoter_test.rb
vmail-2.6.6 test/address_quoter_test.rb
vmail-2.6.5 test/address_quoter_test.rb
vmail-2.6.4 test/address_quoter_test.rb