Sha256: 8ad0bf5a9b1debc112a92893dccc86e56b1040db722dc88705081d93499e1266

Contents?: true

Size: 906 Bytes

Versions: 7

Compression:

Stored size: 906 Bytes

Contents

require 'test_helper'
require 'sup'

module Redwood

class TestPerson < Minitest::Test
  def setup
    @person = Person.new("Thomassen, Bob", "bob@thomassen.com")
    @no_name = Person.new(nil, "alice@alice.com")
  end

  def test_email_must_be_supplied
    assert_raises (ArgumentError) { Person.new("Alice", nil) }
  end

  def test_to_string
    assert_equal "Thomassen, Bob <bob@thomassen.com>", "#{@person}"
    assert_equal "alice@alice.com", "#{@no_name}"
  end

  def test_shortname
    assert_equal "Bob", @person.shortname
    assert_equal "alice@alice.com", @no_name.shortname
  end

  def test_mediumname
    assert_equal "Thomassen, Bob", @person.mediumname
    assert_equal "alice@alice.com", @no_name.mediumname
  end

  def test_fullname
    assert_equal "\"Thomassen, Bob\" <bob@thomassen.com>", @person.full_address
    assert_equal "alice@alice.com", @no_name.full_address
  end
end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sup-1.2 test/unit/test_person.rb
sup-1.1 test/unit/test_person.rb
sup-1.0 test/unit/test_person.rb
sup-0.23 test/unit/test_person.rb
sup-0.22.1 test/unit/test_person.rb
sup-0.22.0 test/unit/test_person.rb
sup-0.21.0 test/unit/test_person.rb