mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 19:20:37 +02:00
Add learning tests for countries
gem
This commit is contained in:
parent
baa7beb51e
commit
207bd9457a
1 changed files with 23 additions and 0 deletions
23
test/learning/countries_test.rb
Normal file
23
test/learning/countries_test.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue