Sha256: 5cbcff9666b16edbc4696337343f6e439248f18f2c227602cc3a0658197d33a5

Contents?: true

Size: 751 Bytes

Versions: 11

Compression:

Stored size: 751 Bytes

Contents

require 'test_helper'

class CountryCodeTest < Test::Unit::TestCase
  def test_alpha2_country_code
    code = CountryCode.new('CA')
    assert_equal 'CA', code.value
    assert_equal 'CA', code.to_s
    assert_equal :alpha2, code.format
  end

  def test_lower_alpha2_country_code
    code = CountryCode.new('ca')
    assert_equal 'CA', code.value
    assert_equal 'CA', code.to_s
    assert_equal :alpha2, code.format
  end

  def test_alpha2_country_code
    code = CountryCode.new('CAN')
    assert_equal :alpha3, code.format
  end

  def test_numeric_code
    code = CountryCode.new('004')
    assert_equal :numeric, code.format
  end

  def test_invalid_code_format
    assert_raise(CountryCodeFormatError){ CountryCode.new('Canada') }
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
active_utils-2.1.1 test/unit/country_code_test.rb
active_utils-2.1.0 test/unit/country_code_test.rb
active_utils-2.0.2 test/unit/country_code_test.rb
active_utils-2.0.1 test/unit/country_code_test.rb
active_utils-2.0.0 test/unit/country_code_test.rb
active_utils-1.0.5 test/unit/country_code_test.rb
active_utils-1.0.4 test/unit/country_code_test.rb
active_utils-1.0.3 test/unit/country_code_test.rb
active_utils-1.0.2 test/unit/country_code_test.rb
active_utils-1.0.1 test/unit/country_code_test.rb
active_utils-1.0.0 test/unit/country_code_test.rb