Skip to content

Commit fe8c610

Browse files
authored
Merge pull request #133 from Shopify/remove-numeric-required-param
Remove numeric as a required param for Country
2 parents fb2c3a1 + a23b60a commit fe8c610

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/active_utils/country.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Country
4040
attr_reader :name
4141

4242
def initialize(options = {})
43-
requires!(options, :name, :alpha2, :alpha3, :numeric)
43+
requires!(options, :name, :alpha2, :alpha3)
4444
@name = options.delete(:name)
4545
@codes = options.collect{|k,v| CountryCode.new(v)}
4646
end

test/unit/country_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,10 @@ def test_qatar_does_not_use_postal_codes
8484
qatar = Country.find('Qatar')
8585
refute qatar.uses_postal_codes?
8686
end
87+
88+
def test_find_country_without_numeric_code
89+
country = Country.find('ASC')
90+
assert_equal 'Ascension Island', country.to_s
91+
assert_nil country.code(:numeric)
92+
end
8793
end

0 commit comments

Comments
 (0)