From 207bd9457ab9029b172cfe64773e27c3bec23d10 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Mon, 25 Feb 2019 22:11:56 +0200 Subject: [PATCH 1/2] Add learning tests for `countries` gem --- test/learning/countries_test.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/learning/countries_test.rb diff --git a/test/learning/countries_test.rb b/test/learning/countries_test.rb new file mode 100644 index 000000000..dda55c6a4 --- /dev/null +++ b/test/learning/countries_test.rb @@ -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 \ No newline at end of file From 113d90f471a3339a0752318335f1435fb9456d30 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Mon, 25 Feb 2019 22:12:04 +0200 Subject: [PATCH 2/2] Update `countries` gem --- Gemfile.lock | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index c26c7dad7..216c2ffda 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -146,10 +146,9 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.3) - countries (2.0.8) - i18n_data (~> 0.7.0) - money (~> 6.7) + concurrent-ruby (1.1.4) + countries (3.0.0) + i18n_data (~> 0.8.0) sixarm_ruby_unaccent (~> 1.1) unicode_utils (~> 1.4) crack (0.4.3) @@ -218,7 +217,7 @@ GEM socksify i18n (0.9.5) concurrent-ruby (~> 1.0) - i18n_data (0.7.0) + i18n_data (0.8.0) ice_nine (0.11.2) isikukood (0.1.2) iso8601 (0.8.6)