countries 5.7.0 → 5.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/countries/cache/countries.json +1 -1
- data/lib/countries/cache/locales/ja.json +1 -1
- data/lib/countries/country/class_methods.rb +1 -1
- data/lib/countries/country/country_subdivision_methods.rb +2 -2
- data/lib/countries/country/emoji.rb +1 -1
- data/lib/countries/country/finder_methods.rb +1 -1
- data/lib/countries/country.rb +2 -2
- data/lib/countries/data/countries/CZ.yaml +1 -3
- data/lib/countries/data/countries/LB.yaml +1 -1
- data/lib/countries/data/countries/PS.yaml +2 -0
- data/lib/countries/data/subdivisions/IN.yaml +9 -9
- data/lib/countries/data/subdivisions/IR.yaml +1 -1
- data/lib/countries/data/translations/countries-ja.yaml +1 -1
- data/lib/countries/version.rb +1 -1
- metadata +2 -28
- data/.codeclimate.yml +0 -61
- data/.github/FUNDING.yml +0 -1
- data/.github/workflows/codeql-analysis.yml +0 -70
- data/.github/workflows/tests.yml +0 -32
- data/.gitignore +0 -25
- data/.rspec +0 -2
- data/.rubocop.yml +0 -49
- data/CHANGELOG.md +0 -776
- data/Gemfile +0 -15
- data/Gemfile.lock +0 -102
- data/LICENSE +0 -24
- data/README.md +0 -404
- data/Rakefile +0 -62
- data/UPGRADE.md +0 -39
- data/bin/console +0 -15
- data/countries.gemspec +0 -31
- data/spec/00_global_spec.rb +0 -58
- data/spec/configuration_spec.rb +0 -60
- data/spec/country_spec.rb +0 -1327
- data/spec/data_spec.rb +0 -260
- data/spec/mongoid_spec.rb +0 -61
- data/spec/perf_spec.rb +0 -74
- data/spec/spec_helper.rb +0 -19
- data/spec/subdivision_spec.rb +0 -42
- data/spec/thread_safety_spec.rb +0 -47
- data/spec/timezone_spec.rb +0 -34
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
|
data/spec/00_global_spec.rb
DELETED
@@ -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
|
data/spec/configuration_spec.rb
DELETED
@@ -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
|