Sha256: 5ee58426882c7808290e039aede6416f9f16bb477d48c25d1eee9774340a5c2a
Contents?: true
Size: 1.68 KB
Versions: 2
Compression:
Stored size: 1.68 KB
Contents
require 'test_helper' class CountryTest < Test::Unit::TestCase include AbtainBilling def test_country_from_hash country = Country.new(:name => 'Canada', :alpha2 => 'CA', :alpha3 => 'CAN', :numeric => '124') assert_equal 'CA', country.code(:alpha2).to_s assert_equal 'CAN', country.code(:alpha3).to_s assert_equal '124', country.code(:numeric).to_s assert_equal 'Canada', country.to_s end def test_country_for_alpha2_code country = Country.find('CA') assert_equal 'CA', country.code(:alpha2).to_s assert_equal 'CAN', country.code(:alpha3).to_s assert_equal '124', country.code(:numeric).to_s assert_equal 'Canada', country.to_s end def test_country_for_alpha3_code country = Country.find('CAN') assert_equal 'Canada', country.to_s end def test_country_for_numeric_code country = Country.find('124') assert_equal 'Canada', country.to_s end def test_find_country_by_name country = Country.find('Canada') assert_equal 'Canada', country.to_s end def test_find_unknown_country_name assert_raise(InvalidCountryCodeError) do Country.find('Asskickistan') end end def test_find_australia country = Country.find('AU') assert_equal 'AU', country.code(:alpha2).to_s country = Country.find('Australia') assert_equal 'AU', country.code(:alpha2).to_s end def test_find_united_kingdom country = Country.find('GB') assert_equal 'GB', country.code(:alpha2).to_s country = Country.find('United Kingdom') assert_equal 'GB', country.code(:alpha2).to_s end def test_raise_on_nil_name assert_raise(InvalidCountryCodeError) do Country.find(nil) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
abtain_billing-1.03 | test/unit/country_test.rb |
abtain_billing-1.02 | test/unit/country_test.rb |