countries 5.7.0 → 5.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/countries.gemspec DELETED
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require File.expand_path('lib/countries/version', __dir__)
4
-
5
- Gem::Specification.new do |gem|
6
- gem.name = 'countries'
7
- gem.version = Countries::VERSION.dup
8
- gem.licenses = ['MIT']
9
- gem.authors = ['Josh Robinson', 'Joe Corcoran', 'Russell Osborne', 'Pedro Moreira']
10
- gem.email = ['hexorx@gmail.com', 'russell@burningpony.com', 'pedro@codecreations.tech']
11
- gem.description = 'All sorts of useful information about every country packaged as pretty little country objects. It includes data from ISO 3166'
12
- gem.summary = 'Gives you a country object full of all sorts of useful information.'
13
- gem.homepage = 'https://github.com/countries/countries'
14
-
15
- gem.metadata = { 'bug_tracker_uri' => 'https://github.com/countries/countries/issues',
16
- 'changelog_uri' => 'https://github.com/countries/countries/blob/master/CHANGELOG.md',
17
- 'source_code_uri' => 'https://github.com/countries/countries',
18
- 'wiki_uri' => 'https://github.com/countries/countries/wiki',
19
- 'rubygems_mfa_required' => 'true' }
20
-
21
- gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
22
- gem.require_paths = ['lib']
23
-
24
- gem.required_ruby_version = '>= 2.7'
25
-
26
- gem.add_dependency('unaccent', '~> 0.3')
27
- gem.add_development_dependency('activesupport', '>= 3')
28
- gem.add_development_dependency('nokogiri', '>= 1.8')
29
- gem.add_development_dependency('rspec', '>= 3')
30
- gem.add_development_dependency('simplecov', '~> 0.22')
31
- end
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe 'global Country class', order: :defined do
4
- context "when loaded via 'iso3166' existence" do
5
- subject { defined?(Country) }
6
-
7
- it { is_expected.to be_falsey }
8
- end
9
-
10
- context "when loaded via 'global'" do
11
- before { require 'countries/global' }
12
-
13
- it 'does not pollute global namespace with Money gem' do
14
- expect(defined?(Money)).not_to be
15
- expect(ISO3166::Country.new('DE').respond_to?(:currency)).not_to be
16
- end
17
-
18
- describe 'existence' do
19
- subject { defined?(Country) }
20
-
21
- it { is_expected.to be_truthy }
22
- end
23
-
24
- describe 'superclass' do
25
- subject { Country.superclass }
26
-
27
- it { is_expected.to eq(ISO3166::Country) }
28
- end
29
-
30
- describe 'to_s' do
31
- it 'should return the country name' do
32
- expect(Country.new('GB').to_s).to eq('United Kingdom of Great Britain and Northern Ireland')
33
- end
34
- end
35
-
36
- describe 'currency' do
37
- it { expect(Country.new('GB').respond_to?(:currency)).not_to be }
38
-
39
- context 'I enable currency extension via config' do
40
- before { ISO3166.configuration.enable_currency_extension! }
41
-
42
- it 'should add currency to global country' do
43
- expect(Country.new('GB').currency).to be
44
- end
45
- end
46
- end
47
-
48
- context 'I enable currency extension via config' do
49
- before { ISO3166.configuration.enable_currency_extension! }
50
-
51
- it 'should add currency to global country' do
52
- expect(Country.new('GB').currency).to be
53
- expect(defined?(Money)).to be
54
- expect(ISO3166::Country.new('DE').currency).to be
55
- end
56
- end
57
- end
58
- end
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'i18n'
5
-
6
- describe 'ISO3166.configuration' do
7
- it 'has a configuration' do
8
- expect(ISO3166.configuration).to be_a ISO3166::Configuration
9
- end
10
-
11
- it 'locales can be changed' do
12
- ISO3166.configuration.locales = [:es]
13
- ISO3166.configuration.locales << :de
14
- expect(ISO3166::Country.new('DE').translation(:de)).to eq 'Deutschland'
15
- expect(ISO3166::Country.new('DE').translation(:es)).to eq 'Alemania'
16
- expect(ISO3166::Country.new('DE').translation(:en)).to eq nil
17
- end
18
-
19
- it 'locales are assumed from I18n.available_locales' do
20
- I18n.available_locales = %i[de en]
21
- ISO3166.reset
22
- expect(ISO3166::Country.new('DE').translation(:de)).to eq 'Deutschland'
23
- expect(ISO3166::Country.new('DE').translation(:es)).to eq nil
24
- end
25
-
26
- it 'unsupported locales do not affect supported locales' do
27
- I18n.available_locales = %i[de en unsupported]
28
- ISO3166.reset
29
- expect(ISO3166::Country.new('DE').translation(:de)).to eq 'Deutschland'
30
- expect(ISO3166::Country.new('DE').translation(:es)).to eq nil
31
- end
32
-
33
- it 'locales can be changed' do
34
- ISO3166.configuration.locales = [:de]
35
- expect(ISO3166::Country.new('DE').translation(:de)).to eq 'Deutschland'
36
- expect(ISO3166::Country.new('DE').translation(:es)).to eq nil
37
- end
38
-
39
- it 'locales can be changed' do
40
- ISO3166.configuration.locales = %i[es de en]
41
- expect(ISO3166::Country.new('DE').translation(:es)).to eq 'Alemania'
42
- expect(ISO3166::Country.new('DE').translation(:en)).to eq 'Germany'
43
- expect(ISO3166::Country.new('DE').translation(:de)).to eq 'Deutschland'
44
- end
45
-
46
- it 'locales can be changed with a block' do
47
- ISO3166.configure do |config|
48
- config.locales = %i[af am ar as az be bg bn br bs ca cs cy da de dz el en
49
- eo es et eu fa fi fo fr ga gl gu he hi hr hu hy ia id
50
- is it ja ka kk km kn ko ku lt lv mi mk ml mn mr ms mt
51
- nb ne nl nn oc or pa pl ps pt ro ru rw si sk sl so sq
52
- sr sv sw ta te th ti tk tl tr tt ug uk ve vi wa wo xh
53
- zh zu]
54
- end
55
-
56
- expect(ISO3166::Country.new('DE').translations.size).to eq 92
57
-
58
- expect(ISO3166.configuration.loaded_locales.size).to eq 92
59
- end
60
- end