test/carmen_test.rb in carmen-0.2.8 vs test/carmen_test.rb in carmen-0.2.9
- old
+ new
@@ -27,10 +27,12 @@
end
def test_country_name
assert_equal 'United States', Carmen.country_name('US')
assert_equal 'United States', Carmen.country_name('us')
+ assert_nil Carmen.country_name('')
+ assert_nil Carmen.country_name(nil)
end
def test_localized_country_name
assert_equal 'Germany', Carmen.country_name('DE')
assert_equal 'Deutschland', Carmen.country_name('DE', :locale => :de)
@@ -50,16 +52,16 @@
assert_equal 'DE', Carmen.country_code('Deutschland')
end
def test_country_codes
assert_equal 'AF', Carmen.country_codes.first
- assert_equal 245, Carmen.country_codes.length
+ assert_equal 253, Carmen.country_codes.length
end
def test_country_names
assert_equal 'Afghanistan', Carmen.country_names.first
- assert_equal 245, Carmen.country_names.length
+ assert_equal 253, Carmen.country_names.length
end
def test_state_name
assert_equal 'IL', Carmen.state_code('Illinois')
assert_equal 'MB', Carmen.state_code('Manitoba', 'CA')
@@ -146,11 +148,10 @@
assert_raises Carmen::StatesNotSupported do
Carmen::state_codes('ID')
end
end
- def test_unsupported_locale
- assert_raises Carmen::UnavailableLocale do
- Carmen.countries(:locale => :latin)
- end
+ def test_special_characters_dont_rails_an_exception
+ assert_equal(nil, Carmen::state_code('alabama\\'))
+ assert_nil(Carmen::country_code('???'))
end
end