iso_country_codes 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,9 +1,8 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rake'
4
4
  gem 'rdoc'
5
5
 
6
6
  group :development do
7
- gem 'jeweler'
8
7
  gem 'nokogiri'
9
8
  end
data/Gemfile.lock CHANGED
@@ -1,11 +1,6 @@
1
1
  GEM
2
- remote: http://rubygems.org/
2
+ remote: https://rubygems.org/
3
3
  specs:
4
- git (1.2.5)
5
- jeweler (1.6.4)
6
- bundler (~> 1.0)
7
- git (>= 1.2.5)
8
- rake
9
4
  json (1.6.1)
10
5
  nokogiri (1.5.2)
11
6
  rake (0.9.2.2)
@@ -16,7 +11,6 @@ PLATFORMS
16
11
  ruby
17
12
 
18
13
  DEPENDENCIES
19
- jeweler
20
14
  nokogiri
21
15
  rake
22
16
  rdoc
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.4.1 / 2013-04-03
2
+
3
+ * Fixed a problem with IsoCountryCodes.search_by_name when an exception is thrown
4
+ * Remvoed Jeweller dependency in development
5
+
1
6
  === 0.4.0 / 2013-01-29
2
7
 
3
8
  * Added country calling codes, which may be accessed with the `calling` instance method
data/Rakefile CHANGED
@@ -1,23 +1,8 @@
1
1
  require 'rake'
2
2
  require './lib/iso_country_codes.rb'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |s|
7
- s.name = 'iso_country_codes'
8
- s.summary = %Q{
9
- Provides ISO 3166-1 country codes/names and ISO 4217 currencies.
10
- }
11
- s.email = "alexrabarts@gmail.com"
12
- s.homepage = "http://github.com/alexrabarts/iso_country_codes"
13
- s.description = "ISO country code and currency library"
14
- s.authors = ["alex"]
15
- end
16
- rescue LoadError
17
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
18
- end
19
-
3
+ require 'bundler/gem_tasks'
20
4
  require 'rake/testtask'
5
+
21
6
  Rake::TestTask.new(:test) do |t|
22
7
  t.libs << 'lib' << 'test'
23
8
  t.pattern = 'test/**/*_test.rb'
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.4.1
@@ -1,58 +1,21 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
1
  # -*- encoding: utf-8 -*-
5
2
 
6
3
  Gem::Specification.new do |s|
7
4
  s.name = %q{iso_country_codes}
8
- s.version = "0.4.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["alex"]
12
- s.date = %q{2013-01-29}
5
+ s.version = File.read('VERSION').strip
6
+ s.authors = ["Alex Rabarts"]
13
7
  s.description = %q{ISO country code and currency library}
14
- s.email = %q{alexrabarts@gmail.com}
15
- s.extra_rdoc_files = [
16
- "README.rdoc"
17
- ]
18
- s.files = [
19
- ".gitignore",
20
- "Gemfile",
21
- "Gemfile.lock",
22
- "History.txt",
23
- "Manifest.txt",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION.yml",
27
- "iso_country_codes.gemspec",
28
- "lib/iso_country_codes.rb",
29
- "lib/iso_country_codes/calling.rb",
30
- "lib/iso_country_codes/code.rb",
31
- "lib/iso_country_codes/iso_3166_1.rb",
32
- "lib/iso_country_codes/iso_4217.rb",
33
- "lib/iso_country_codes/iso_country_codes.rb",
34
- "rakelib/cultivate.rake",
35
- "rakelib/iso_3166_1.rake",
36
- "rakelib/iso_3166_1.rb",
37
- "rakelib/iso_3166_1.rb.erb",
38
- "test/iso_country_codes_test.rb"
39
- ]
8
+ s.summary = %q{Provides ISO 3166-1 country codes/names and ISO 4217 currencies.}
40
9
  s.homepage = %q{http://github.com/alexrabarts/iso_country_codes}
10
+ s.email = %q{alexrabarts@gmail.com}
11
+ s.extra_rdoc_files = ["README.rdoc"]
12
+ s.files = `git ls-files`.split("\n")
13
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
41
15
  s.rdoc_options = ["--charset=UTF-8"]
42
- s.require_paths = ["lib"]
43
- s.rubygems_version = %q{1.3.7}
44
- s.summary = %q{Provides ISO 3166-1 country codes/names and ISO 4217 currencies.}
45
- s.test_files = [
46
- "test/iso_country_codes_test.rb"
47
- ]
48
-
49
- if s.respond_to? :specification_version then
50
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
51
- s.specification_version = 3
16
+ s.require_paths = ['lib']
52
17
 
53
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
54
- else
55
- end
56
- else
18
+ ['bundler', 'shoulda', 'mocha', 'nokogiri'].each do |gem|
19
+ s.add_development_dependency *gem.split(' ')
57
20
  end
58
21
  end
@@ -37,7 +37,7 @@ class IsoCountryCodes # :nodoc:
37
37
  instances = all.select { |c| c.name.match(/^#{str}/i) } if instances.empty?
38
38
  instances = all.select { |c| c.name.match(/#{str}/i) } if instances.empty?
39
39
 
40
- raise UnknownCodeError, "No ISO 3166-1 codes could be found searching with name '#{code}'." if instances.empty?
40
+ raise UnknownCodeError, "No ISO 3166-1 codes could be found searching with name '#{str}'." if instances.empty?
41
41
 
42
42
  instances
43
43
  end
@@ -68,4 +68,4 @@ class IsoCountryCodes # :nodoc:
68
68
  instances
69
69
  end
70
70
  end
71
- end
71
+ end
@@ -22,6 +22,12 @@ class TestIsoCountryCodes < Test::Unit::TestCase
22
22
  assert_equal IsoCountryCodes::Code::AUS.instance, IsoCountryCodes.find('AU')
23
23
  end
24
24
 
25
+ def test_find_with_unknown_alpha2_code_and_raise_exception
26
+ assert_raise IsoCountryCodes::UnknownCodeError do
27
+ IsoCountryCodes.find('xx')
28
+ end
29
+ end
30
+
25
31
  def test_find_with_lowercase_alpha3
26
32
  assert_equal IsoCountryCodes::Code::AUS.instance, IsoCountryCodes.find('aus')
27
33
  end
@@ -59,6 +65,12 @@ class TestIsoCountryCodes < Test::Unit::TestCase
59
65
  ], IsoCountryCodes.search_by_name('democratic'))
60
66
  end
61
67
 
68
+ def test_search_by_name_unknown_country_and_raise_exception
69
+ assert_raise IsoCountryCodes::UnknownCodeError do
70
+ IsoCountryCodes.search_by_name('unknown country')
71
+ end
72
+ end
73
+
62
74
  def test_search_by_currency_lowercase
63
75
  assert_equal([
64
76
  IsoCountryCodes::Code::CCK.instance,
@@ -83,6 +95,12 @@ class TestIsoCountryCodes < Test::Unit::TestCase
83
95
  ], IsoCountryCodes.search_by_currency('AUD'))
84
96
  end
85
97
 
98
+ def test_search_by_currency_invalid_value_and_raise_exception
99
+ assert_raise IsoCountryCodes::UnknownCodeError do
100
+ IsoCountryCodes.search_by_currency('USS')
101
+ end
102
+ end
103
+
86
104
  def test_search_by_calling_code
87
105
  assert_equal [IsoCountryCodes::Code::ZAF.instance], IsoCountryCodes.search_by_calling_code('+27')
88
106
  assert_equal([
@@ -92,6 +110,12 @@ class TestIsoCountryCodes < Test::Unit::TestCase
92
110
  ], IsoCountryCodes.search_by_calling_code('+61'))
93
111
  end
94
112
 
113
+ def test_search_by_calling_code_invalid_value_and_raise_exception
114
+ assert_raise IsoCountryCodes::UnknownCodeError do
115
+ IsoCountryCodes.search_by_calling_code('00')
116
+ end
117
+ end
118
+
95
119
  def test_get_main_currency
96
120
  assert_equal 'AUD', IsoCountryCodes.find('AUS').main_currency
97
121
  end
metadata CHANGED
@@ -1,33 +1,87 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: iso_country_codes
3
- version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 4
9
- - 0
10
- version: 0.4.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.1
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
13
- - alex
7
+ authors:
8
+ - Alex Rabarts
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2013-01-29 00:00:00 +00:00
19
- default_executable:
20
- dependencies: []
21
-
12
+ date: 2013-04-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: shoulda
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: mocha
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: nokogiri
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
22
78
  description: ISO country code and currency library
23
79
  email: alexrabarts@gmail.com
24
80
  executables: []
25
-
26
81
  extensions: []
27
-
28
- extra_rdoc_files:
82
+ extra_rdoc_files:
29
83
  - README.rdoc
30
- files:
84
+ files:
31
85
  - .gitignore
32
86
  - Gemfile
33
87
  - Gemfile.lock
@@ -35,7 +89,7 @@ files:
35
89
  - Manifest.txt
36
90
  - README.rdoc
37
91
  - Rakefile
38
- - VERSION.yml
92
+ - VERSION
39
93
  - iso_country_codes.gemspec
40
94
  - lib/iso_country_codes.rb
41
95
  - lib/iso_country_codes/calling.rb
@@ -48,39 +102,30 @@ files:
48
102
  - rakelib/iso_3166_1.rb
49
103
  - rakelib/iso_3166_1.rb.erb
50
104
  - test/iso_country_codes_test.rb
51
- has_rdoc: true
52
105
  homepage: http://github.com/alexrabarts/iso_country_codes
53
106
  licenses: []
54
-
55
107
  post_install_message:
56
- rdoc_options:
108
+ rdoc_options:
57
109
  - --charset=UTF-8
58
- require_paths:
110
+ require_paths:
59
111
  - lib
60
- required_ruby_version: !ruby/object:Gem::Requirement
112
+ required_ruby_version: !ruby/object:Gem::Requirement
61
113
  none: false
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- hash: 3
66
- segments:
67
- - 0
68
- version: "0"
69
- required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
119
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
120
+ requirements:
121
+ - - '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
78
124
  requirements: []
79
-
80
125
  rubyforge_project:
81
- rubygems_version: 1.3.7
126
+ rubygems_version: 1.8.25
82
127
  signing_key:
83
128
  specification_version: 3
84
129
  summary: Provides ISO 3166-1 country codes/names and ISO 4217 currencies.
85
- test_files:
130
+ test_files:
86
131
  - test/iso_country_codes_test.rb
data/VERSION.yml DELETED
@@ -1,4 +0,0 @@
1
- ---
2
- :minor: 4
3
- :patch: 0
4
- :major: 0