Skip to content

Commit

Permalink
Remove numeric as a required param for Country
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenpslade committed Jan 14, 2025
1 parent fb2c3a1 commit a23b60a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/active_utils/country.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Country
attr_reader :name

def initialize(options = {})
requires!(options, :name, :alpha2, :alpha3, :numeric)
requires!(options, :name, :alpha2, :alpha3)
@name = options.delete(:name)
@codes = options.collect{|k,v| CountryCode.new(v)}
end
Expand Down
6 changes: 6 additions & 0 deletions test/unit/country_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,10 @@ def test_qatar_does_not_use_postal_codes
qatar = Country.find('Qatar')
refute qatar.uses_postal_codes?
end

def test_find_country_without_numeric_code
country = Country.find('ASC')
assert_equal 'Ascension Island', country.to_s
assert_nil country.code(:numeric)
end
end

0 comments on commit a23b60a

Please sign in to comment.