countries 2.0.8 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/README.markdown +90 -93
- data/countries.gemspec +3 -3
- data/lib/countries/cache/countries.json +1 -1
- data/lib/countries/cache/locales/he.json +1 -1
- data/lib/countries/country.rb +2 -2
- data/lib/countries/country/class_methods.rb +4 -1
- data/lib/countries/country/emoji.rb +3 -0
- data/lib/countries/data/countries/BR.yaml +2 -2
- data/lib/countries/data/countries/FJ.yaml +1 -1
- data/lib/countries/data/countries/GB.yaml +1 -0
- data/lib/countries/data/countries/HK.yaml +1 -1
- data/lib/countries/data/subdivisions/FR.yaml +182 -0
- data/lib/countries/data/translation_corrections.yaml +3 -0
- data/lib/countries/version.rb +1 -1
- data/spec/country_spec.rb +21 -0
- data/spec/data_spec.rb +12 -0
- metadata +7 -7
data/lib/countries/version.rb
CHANGED
data/spec/country_spec.rb
CHANGED
@@ -318,6 +318,27 @@ describe ISO3166::Country do
|
|
318
318
|
|
319
319
|
describe 'all_names_with_codes' do
|
320
320
|
require 'active_support/core_ext/string/output_safety'
|
321
|
+
it 'should return an alphabetized list of all country names with ISOCODE alpha2' do
|
322
|
+
countries = ISO3166::Country.all_names_with_codes
|
323
|
+
expect(countries).to be_an(Array)
|
324
|
+
expect(countries.first[0]).to be_a(String)
|
325
|
+
expect(countries.first[0]).to eq('Afghanistan')
|
326
|
+
expect(countries.size).to eq(NUM_OF_COUNTRIES)
|
327
|
+
expect(countries.any?{|pair| !pair[0].html_safe?}).to eq(false)
|
328
|
+
end
|
329
|
+
|
330
|
+
it 'should return an alphabetized list of all country names translated to current locale with ISOCODE alpha2' do
|
331
|
+
ISO3166.configuration.locales = [:es, :de, :en]
|
332
|
+
|
333
|
+
countries = ISO3166::Country.all_names_with_codes(:es)
|
334
|
+
expect(countries).to be_an(Array)
|
335
|
+
expect(countries.first[0]).to be_a(String)
|
336
|
+
expect(countries.first[0]).to eq('Afganistán')
|
337
|
+
expect(countries.size).to eq(NUM_OF_COUNTRIES)
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
describe 'all_names_with_codes_without_active_support' do
|
321
342
|
it 'should return an alphabetized list of all country names with ISOCODE alpha2' do
|
322
343
|
countries = ISO3166::Country.all_names_with_codes
|
323
344
|
expect(countries).to be_an(Array)
|
data/spec/data_spec.rb
CHANGED
@@ -96,6 +96,10 @@ describe ISO3166::Data do
|
|
96
96
|
ISO3166::Data.register(
|
97
97
|
alpha2: 'TW',
|
98
98
|
name: 'NEW Taiwan',
|
99
|
+
subdivisions: {
|
100
|
+
CHA: {name: 'New Changhua'},
|
101
|
+
CYI: {name: 'New Municipality'}
|
102
|
+
},
|
99
103
|
translations: {
|
100
104
|
'en' => 'NEW Taiwan',
|
101
105
|
'de' => 'NEW Taiwan'
|
@@ -112,6 +116,8 @@ describe ISO3166::Data do
|
|
112
116
|
expect(subject.name).to eq 'NEW Taiwan'
|
113
117
|
expect(subject.translations).to eq('en' => 'NEW Taiwan',
|
114
118
|
'de' => 'NEW Taiwan')
|
119
|
+
expect(subject.subdivisions).to eq(CHA: ISO3166::Subdivision.new({name: 'New Changhua'}),
|
120
|
+
CYI: ISO3166::Subdivision.new({name: 'New Municipality'}))
|
115
121
|
end
|
116
122
|
end
|
117
123
|
|
@@ -120,6 +126,10 @@ describe ISO3166::Data do
|
|
120
126
|
ISO3166::Data.register(
|
121
127
|
alpha2: 'LOL',
|
122
128
|
name: 'Happy Country',
|
129
|
+
subdivisions: {
|
130
|
+
LOL1: {name: 'Happy sub1'},
|
131
|
+
LOL2: {name: 'Happy sub2'}
|
132
|
+
},
|
123
133
|
translations: {
|
124
134
|
'en' => 'Happy Country',
|
125
135
|
'de' => 'glückliches Land'
|
@@ -133,6 +143,8 @@ describe ISO3166::Data do
|
|
133
143
|
data = ISO3166::Data.new('LOL').call
|
134
144
|
expect(data['name']).to eq 'Happy Country'
|
135
145
|
expect(subject.name).to eq 'Happy Country'
|
146
|
+
expect(subject.subdivisions).to eq(LOL1: ISO3166::Subdivision.new({name: 'Happy sub1'}),
|
147
|
+
LOL2: ISO3166::Subdivision.new({name: 'Happy sub2'}))
|
136
148
|
end
|
137
149
|
|
138
150
|
it 'detect a stale cache' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: countries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Robinson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-07-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: i18n_data
|
@@ -18,28 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.8.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.
|
28
|
+
version: 0.8.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: money
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '6.
|
35
|
+
version: '6.9'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '6.
|
42
|
+
version: '6.9'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: unicode_utils
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -704,7 +704,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
704
704
|
version: '0'
|
705
705
|
requirements: []
|
706
706
|
rubyforge_project:
|
707
|
-
rubygems_version: 2.
|
707
|
+
rubygems_version: 2.6.12
|
708
708
|
signing_key:
|
709
709
|
specification_version: 4
|
710
710
|
summary: Gives you a country object full of all sorts of useful information.
|