Skip to content

Commit

Permalink
NETHERLANDS ANTILLES is no longer recognized by ISO 3166-1 Standard.
Browse files Browse the repository at this point in the history
  • Loading branch information
rposborne committed Sep 27, 2016
1 parent bbeaf54 commit 8389221
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 59 deletions.
2 changes: 1 addition & 1 deletion lib/countries/cache/countries.json

Large diffs are not rendered by default.

46 changes: 0 additions & 46 deletions lib/countries/data/countries/AN.yaml

This file was deleted.

22 changes: 11 additions & 11 deletions spec/country_spec.rb
@@ -1,7 +1,7 @@
# encoding: utf-8

require 'spec_helper'

NUM_OF_COUNTRIES = 249
describe ISO3166::Country do
let(:country) { ISO3166::Country.search('US') }

Expand Down Expand Up @@ -265,15 +265,15 @@
countries = ISO3166::Country.all
expect(countries).to be_an(Array)
expect(countries.first).to be_an(ISO3166::Country)
expect(countries.size).to eq(250)
expect(countries.size).to eq(NUM_OF_COUNTRIES)
end

it 'should allow to customize each country representation passing a block to the method' do
countries = ISO3166::Country.all { |country, data| [data['name'], country, data['country_code']] }
expect(countries).to be_an(Array)
expect(countries.first).to be_an(Array)
expect(countries.first.size).to eq(3)
expect(countries.size).to eq(250)
expect(countries.size).to eq(NUM_OF_COUNTRIES)
end
end

Expand All @@ -285,15 +285,15 @@
expect(countries.first).to eq('Afghanistan')
# countries missing the desired locale will not be added to the list
# so all 250 countries may not be returned, 'fr' returns 249, for example
expect(countries.size).to eq(249)
expect(countries.size).to eq(NUM_OF_COUNTRIES)
end

it 'should return an alphabetized list of all country names in English if no locale is passed' do
countries = ISO3166::Country.all_translated
expect(countries).to be_an(Array)
expect(countries.first).to be_a(String)
expect(countries.first).to eq('Afghanistan')
expect(countries.size).to eq(249)
expect(countries.size).to eq(NUM_OF_COUNTRIES)
end
end

Expand All @@ -304,7 +304,7 @@
expect(countries).to be_an(Array)
expect(countries.first[0]).to be_a(String)
expect(countries.first[0]).to eq('Afghanistan')
expect(countries.size).to eq(250)
expect(countries.size).to eq(NUM_OF_COUNTRIES)
end

it 'should return an alphabetized list of all country names translated to current locale with ISOCODE alpha2' do
Expand All @@ -314,7 +314,7 @@
expect(countries).to be_an(Array)
expect(countries.first[0]).to be_a(String)
expect(countries.first[0]).to eq('Afganistán')
expect(countries.size).to eq(250)
expect(countries.size).to eq(NUM_OF_COUNTRIES)
end
end

Expand Down Expand Up @@ -346,15 +346,15 @@
expect(countries.first).to eq(%w(AF Afghanistan))
# countries missing the desired locale will not be added to the list
# so all 250 countries may not be returned, 'fr' returns 249, for example
expect(countries.size).to eq(249)
expect(countries.size).to eq(NUM_OF_COUNTRIES)
end

it 'should return an hash of all country names in English if no locale is passed' do
countries = ISO3166::Country.translations
expect(countries).to be_an(Hash)
expect(countries.first[0]).to eq('AF')
expect(countries.first).to eq(%w(AF Afghanistan))
expect(countries.size).to eq(249)
expect(countries.size).to eq(NUM_OF_COUNTRIES)
end
end

Expand Down Expand Up @@ -395,7 +395,7 @@
describe 'codes' do
it 'returns a hash with the data of the country' do
expect(ISO3166::Country.codes).to be_a Array
expect(ISO3166::Country.codes.size).to eq(250)
expect(ISO3166::Country.codes.size).to eq(NUM_OF_COUNTRIES)
end
end

Expand Down Expand Up @@ -693,7 +693,7 @@
end

it 'should return nil if the country does not have a GEC code' do
expect(ISO3166::Country.new('AN').gec).to eql nil
expect(ISO3166::Country.new('UM').gec).to eql nil
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/data_spec.rb
Expand Up @@ -29,7 +29,7 @@
it 'returns an array' do
data = ISO3166::Data.codes
expect(data).to be_a Array
expect(data.size).to eq 250
expect(data.size).to eq 249
end
end

Expand Down

0 comments on commit 8389221

Please sign in to comment.