Merge pull request #1086 from internetee/update-countries-gem

Update countries gem
This commit is contained in:
Timo Võhmar 2019-02-27 20:02:32 +02:00 committed by GitHub
commit dd92633cf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 5 deletions

View file

@ -0,0 +1,23 @@
require 'test_helper'
class CountriesLearningTest < ActiveSupport::TestCase
def test_returns_all_countries
assert_respond_to Country.all, :sort_by
end
def test_returns_country_name
assert_equal 'United States of America', Country.new('US').name
end
def test_returns_country_alpha2_code
assert_equal 'US', Country.new('US').alpha2
end
def test_returns_country_alpha3_code
assert_equal 'USA', Country.new('US').alpha3
end
def test_validates_code_when_creating_an_instance_of_country
assert_not Country.new('invalid')
end
end