iso_country_codes 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1 +1 @@
1
- pkg
1
+ iso_country_codes-*.gem
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.4.2 / 2013-09-17
2
+
3
+ * Fixed a problem with IsoCountryCodes.search_by_name when the result is an exact match
4
+
1
5
  === 0.4.1 / 2013-04-03
2
6
 
3
7
  * Fixed a problem with IsoCountryCodes.search_by_name when an exception is thrown
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -33,7 +33,7 @@ class IsoCountryCodes # :nodoc:
33
33
  end
34
34
 
35
35
  def search_by_name(str)
36
- instances = all.select { |c| c.name.upcase == str }
36
+ instances = all.select { |c| c.name.upcase == str.upcase }
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
 
@@ -71,6 +71,13 @@ class TestIsoCountryCodes < Test::Unit::TestCase
71
71
  end
72
72
  end
73
73
 
74
+ def test_search_by_name_exact_match
75
+ assert_equal(
76
+ [IsoCountryCodes::Code::CCK.instance],
77
+ IsoCountryCodes.search_by_name('Cocos (Keeling) Islands')
78
+ )
79
+ end
80
+
74
81
  def test_search_by_currency_lowercase
75
82
  assert_equal([
76
83
  IsoCountryCodes::Code::CCK.instance,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iso_country_codes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-03 00:00:00.000000000 Z
12
+ date: 2013-09-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler