Sha256: 5062fec795b84ca73a82627720c57ca298d356c5fd6b593c5b3f526cb14c3da4

Contents?: true

Size: 989 Bytes

Versions: 1

Compression:

Stored size: 989 Bytes

Contents

# encoding: utf-8
require 'test_helper'
require 'uncharted'


class TestCountry < MiniTest::Unit::TestCase

  def setup
    @br = Uncharted::Country.find('BR')
  end

  def test_country_lookup
    assert @br, "BR must exist"
    assert_equal 'BR',     @br.alpha2
    assert_equal 'BRA',    @br.alpha3
    assert_equal 'Brazil', @br.name
  end

  def test_to_s
    assert_equal 'BR', @br.to_s
  end

  def test_territories
    assert_equal  1, @br.districts.count
    assert_equal 26, @br.states.count
    assert @br.territories.empty?

    assert_equal [:district, :state], @br.subdivisions.keys.sort
    assert_equal 'ParanĂ¡', Uncharted::Territory.find('BR-PR').name
    assert_equal 'PR', Uncharted::Territory.find('BR-PR').abbr
  end
  
  def test_classes
    assert_equal Country,   Uncharted::Country
    assert_equal Territory, Uncharted::Territory
    assert_equal Country::Field, Uncharted::Country::Field
    assert_equal Territory::Field, Uncharted::Territory::Field
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
uncharted-0.0.5 test/country_test.rb