geonames_local 3.3.1 → 3.3.3

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.
@@ -1,275 +1,272 @@
1
- # -*- coding: utf-8 -*-
2
- require "spec_helper"
3
- require "geo_ruby"
1
+ require 'spec_helper'
4
2
 
5
3
  describe Spot do
6
4
 
7
- describe "Parsing Dump" do
5
+ describe 'Parsing Dump' do
8
6
 
9
7
  let(:spot) { Spot.new("6319037\tMaxaranguape\tMaxaranguape\t\t-5.46874226086957\t-35.3565714695652\tA\tADM2\tBR\t22\t2407500\t6593\t\t12\t\t\t\tAmerica/Recife\t2006-12-17", :dump) }
10
8
 
11
- it "should parse geoid integer" do
12
- spot.geoname_id.should eql(6319037)
13
- spot.gid.should eql(6319037)
9
+ it 'should parse geoid integer' do
10
+ expect(spot.geoname_id).to eql(6_319_037)
11
+ expect(spot.gid).to eql(6_319_037)
14
12
  end
15
13
 
16
- it "should parse code" do
17
- spot.code.should eql("6593")
14
+ it 'should parse code' do
15
+ expect(spot.code).to eql('6593')
18
16
  end
19
17
 
20
- it "should parse region code" do
21
- spot.region.should eql("2407500")
18
+ it 'should parse region code' do
19
+ expect(spot.region).to eql('2407500')
22
20
  end
23
21
 
24
- it "should parse name" do
25
- spot.name.should eql("Maxaranguape")
26
- spot.ascii.should eql("Maxaranguape")
22
+ it 'should parse name' do
23
+ expect(spot.name).to eql('Maxaranguape')
24
+ expect(spot.ascii).to eql('Maxaranguape')
27
25
  end
28
26
 
29
- it "should parse geostuff" do
30
- spot.lat.should be_within(0.001).of(-5.4687)
31
- spot.y.should be_within(0.001).of(-5.4687)
32
- spot.lon.should be_within(0.001).of(-35.3565)
27
+ it 'should parse geostuff' do
28
+ expect(spot.lat).to be_within(0.001).of(-5.4687)
29
+ expect(spot.y).to be_within(0.001).of(-5.4687)
30
+ expect(spot.lon).to be_within(0.001).of(-35.3565)
33
31
  end
34
32
 
35
- it "should parse spot kind" do
36
- spot.kind.should eql(:city)
33
+ it 'should parse spot kind' do
34
+ expect(spot.kind).to eql(:city)
37
35
  end
38
36
 
39
- it "should parse spot nation" do
40
- spot.nation.should eql("BR")
37
+ it 'should parse spot nation' do
38
+ expect(spot.nation).to eql('BR')
41
39
  end
42
40
 
43
- it "shuold parse timezone" do
44
- spot.tz.should eql("America/Recife")
41
+ it 'shuold parse timezone' do
42
+ expect(spot.tz).to eql('America/Recife')
45
43
  end
46
44
 
47
- it "should parse updated_at" do
48
- spot.updated_at.should be_instance_of(Time)
49
- spot.updated_at.day.should eql(17)
45
+ it 'should parse updated_at' do
46
+ expect(spot.updated_at).to be_instance_of(Time)
47
+ expect(spot.updated_at.day).to eql(17)
50
48
  end
51
49
  end
52
50
 
53
- describe "More Parsing" do
51
+ describe 'More Parsing' do
54
52
 
55
53
  let(:spot) { Geonames::Spot.new("3384862\tRiacho Zuza\tRiacho Zuza\t\t-9.4333333\t-37.6666667\tH\tSTMI\tBR\t\t02\t\t\t\t0\t\t241\tAmerica/Maceio\t1993-12-17\n", :dump) }
56
54
 
57
- it "should parse geoid integer" do
58
- spot.geoname_id.should eql(3384862)
55
+ it 'should parse geoid integer' do
56
+ expect(spot.geoname_id).to eql(3_384_862)
59
57
  end
60
58
 
61
- it "should parse name" do
62
- spot.name.should eql("Riacho Zuza")
63
- spot.ascii.should eql("Riacho Zuza")
59
+ it 'should parse name' do
60
+ expect(spot.name).to eql('Riacho Zuza')
61
+ expect(spot.ascii).to eql('Riacho Zuza')
64
62
  end
65
63
 
66
- it "should parse geostuff" do
67
- spot.lat.should be_within(0.001).of(-9.4333333)
68
- spot.lon.should be_within(0.001).of(-37.6666667)
64
+ it 'should parse geostuff' do
65
+ expect(spot.lat).to be_within(0.001).of(-9.4333333)
66
+ expect(spot.lon).to be_within(0.001).of(-37.6666667)
69
67
  end
70
68
 
71
- it "should parse spot kind" do
72
- spot.kind.should eql(:other)
69
+ it 'should parse spot kind' do
70
+ expect(spot.kind).to eql(:other)
73
71
  end
74
72
 
75
- it "should parse spot nation" do
76
- spot.nation.should eql("BR")
73
+ it 'should parse spot nation' do
74
+ expect(spot.nation).to eql('BR')
77
75
  end
78
76
 
79
- it "shuold parse timezone" do
80
- spot.tz.should eql("America/Maceio")
77
+ it 'shuold parse timezone' do
78
+ expect(spot.tz).to eql('America/Maceio')
81
79
  end
82
80
 
83
- it "should parse updated_at" do
84
- spot.updated_at.should be_instance_of(Time)
85
- spot.updated_at.day.should eql(17)
81
+ it 'should parse updated_at' do
82
+ expect(spot.updated_at).to be_instance_of(Time)
83
+ expect(spot.updated_at.day).to eql(17)
86
84
  end
87
85
  end
88
86
 
89
- describe "Parsing Region" do
87
+ describe 'Parsing Region' do
90
88
 
91
89
  let(:spot) { Geonames::Spot.new("3457153\tEstado de Minas Gerais\tEstado de Minas Gerais\tMinas,Minas Geraes,Minas Gerais\t-18.0\t-44.0\tA\tADM1\tBR\tBR\t15\t\t\t\t16672613\t\t1219\tAmerica/Sao_Paulo\t2007-05-15\n", :dump) }
92
90
 
93
- it "should be kind of region" do
94
- spot.kind.should eql(:region)
91
+ it 'should be kind of region' do
92
+ expect(spot.kind).to eql(:region)
95
93
  end
96
94
 
97
- it "should parse geoid" do
98
- spot.geoname_id.should eql(3457153)
99
- spot.gid.should eql(3457153)
95
+ it 'should parse geoid' do
96
+ expect(spot.geoname_id).to eql(3_457_153)
97
+ expect(spot.gid).to eql(3_457_153)
100
98
  end
101
99
 
102
- it "should parse code" do
103
- spot.code.should be_empty
100
+ it 'should parse code' do
101
+ expect(spot.code).to be_empty
104
102
  end
105
103
 
106
- it "should parse region code" do
107
- spot.region.should eql("15")
104
+ it 'should parse region code' do
105
+ expect(spot.region).to eql('15')
108
106
  end
109
107
 
110
- it "should create abbr" do
111
- spot.abbr.should eql("MG")
108
+ it 'should create abbr' do
109
+ expect(spot.abbr).to eql('MG')
112
110
  end
113
111
 
114
- it "should parse name" do
115
- spot.name.should eql("Minas Gerais")
116
- spot.ascii.should eql("Estado de Minas Gerais")
112
+ it 'should parse name' do
113
+ expect(spot.name).to eql('Minas Gerais')
114
+ expect(spot.ascii).to eql('Estado de Minas Gerais')
117
115
  end
118
116
 
119
- it "should parse geostuff" do
120
- spot.lat.should be_within(0.001).of(-18.0)
121
- spot.lon.should be_within(0.001).of(-44.0)
117
+ it 'should parse geostuff' do
118
+ expect(spot.lat).to be_within(0.001).of(-18.0)
119
+ expect(spot.lon).to be_within(0.001).of(-44.0)
122
120
  end
123
121
 
124
122
  end
125
123
 
126
- describe "Parsing City" do
124
+ describe 'Parsing City' do
127
125
 
128
126
  let(:spot) { Spot.new "3386859\tTamboril\tTamboril\t\t-4.9931\t-40.26738\tA\tADM2\tBR\t\t06\t2313203\t\t\t25455\t\t401\tAmerica/Fortaleza\t2011-04-21" }
129
127
 
130
- it "should parse name" do
131
- spot.name.should eql("Tamboril")
128
+ it 'should parse name' do
129
+ expect(spot.name).to eql('Tamboril')
132
130
  end
133
131
 
134
- it "should parse ascii name" do
135
- spot.name.should eql("Tamboril")
132
+ it 'should parse ascii name' do
133
+ expect(spot.name).to eql('Tamboril')
136
134
  end
137
135
 
138
- it "should parse x" do
139
- spot.x.should be_within(0.001).of(-40.26738)
136
+ it 'should parse x' do
137
+ expect(spot.x).to be_within(0.001).of(-40.26738)
140
138
  end
141
139
 
142
- it "should parse y" do
143
- spot.y.should be_within(0.001).of(-4.9931)
140
+ it 'should parse y' do
141
+ expect(spot.y).to be_within(0.001).of(-4.9931)
144
142
  end
145
143
 
146
- it "should parse tz" do
147
- spot.tz.should eql("America/Fortaleza")
144
+ it 'should parse tz' do
145
+ expect(spot.tz).to eql('America/Fortaleza')
148
146
  end
149
147
 
150
- it "should parse kind" do
151
- spot.kind.should eql(:city)
148
+ it 'should parse kind' do
149
+ expect(spot.kind).to eql(:city)
152
150
  end
153
151
 
154
- it "should parse nation" do
155
- spot.nation.should eql("BR")
152
+ it 'should parse nation' do
153
+ expect(spot.nation).to eql('BR')
156
154
  end
157
155
 
158
- it "should parse region" do
159
- spot.region.should eql("06")
156
+ it 'should parse region' do
157
+ expect(spot.region).to eql('06')
160
158
  end
161
159
 
162
- it "should parse pop" do
163
- spot.pop.should eql("25455")
160
+ it 'should parse pop' do
161
+ expect(spot.pop).to eql('25455')
164
162
  end
165
163
 
166
164
  end
167
165
 
168
- describe "Parsing Big City" do
166
+ describe 'Parsing Big City' do
169
167
 
170
168
  let(:spot) { Spot.new "6322846\tLondrina\tLondrina\t\t-23.58643\t-51.08739\tA\tADM2\tBR\t\t18\t4113700\t\t\t506645\t\t544\tAmerica/Sao_Paulo\t2011-04-21" }
171
169
 
172
- it "should parse name" do
173
- spot.name.should eql("Londrina")
170
+ it 'should parse name' do
171
+ expect(spot.name).to eql('Londrina')
174
172
  end
175
173
 
176
- it "should parse ascii name" do
177
- spot.name.should eql("Londrina")
174
+ it 'should parse ascii name' do
175
+ expect(spot.name).to eql('Londrina')
178
176
  end
179
177
 
180
- it "should parse x" do
181
- spot.x.should be_within(0.001).of(-51.08739)
178
+ it 'should parse x' do
179
+ expect(spot.x).to be_within(0.001).of(-51.08739)
182
180
  end
183
181
 
184
- it "should parse y" do
185
- spot.y.should be_within(0.001).of(-23.58643)
182
+ it 'should parse y' do
183
+ expect(spot.y).to be_within(0.001).of(-23.58643)
186
184
  end
187
185
 
188
- it "should parse tz" do
189
- spot.tz.should eql("America/Sao_Paulo")
186
+ it 'should parse tz' do
187
+ expect(spot.tz).to eql('America/Sao_Paulo')
190
188
  end
191
189
 
192
- it "should parse kind" do
193
- spot.kind.should eql(:city)
190
+ it 'should parse kind' do
191
+ expect(spot.kind).to eql(:city)
194
192
  end
195
193
 
196
- it "should parse nation" do
197
- spot.nation.should eql("BR")
194
+ it 'should parse nation' do
195
+ expect(spot.nation).to eql('BR')
198
196
  end
199
197
 
200
- it "should parse region" do
201
- spot.region.should eql("18")
198
+ it 'should parse region' do
199
+ expect(spot.region).to eql('18')
202
200
  end
203
201
 
204
- it "should parse pop" do
205
- spot.pop.should eql("506645")
202
+ it 'should parse pop' do
203
+ expect(spot.pop).to eql('506645')
206
204
  end
207
205
 
208
-
209
206
  end
210
207
 
211
- describe "Parsing Zip" do
208
+ describe 'Parsing Zip' do
212
209
 
213
210
  let(:spot) { Geonames::Spot.new("BR\t76375-000\tHidrolina\tGoias\t\t5209804\t29\t\t\t-14.7574\t-49.3596\t\n", :zip) }
214
211
 
215
- it "should parse zip oO" do
216
- spot.zip.should eql("76375-000")
212
+ it 'should parse zip oO' do
213
+ expect(spot.zip).to eql('76375-000')
217
214
  end
218
215
 
219
- it "should be a city" do
220
- spot.kind.should eql(:city)
216
+ it 'should be a city' do
217
+ expect(spot.kind).to eql(:city)
221
218
  end
222
219
 
223
- it "should parse code" do
224
- spot.code.should eql("29")
220
+ it 'should parse code' do
221
+ expect(spot.code).to eql('29')
225
222
  end
226
223
 
227
- it "should parse geoid integer" do
228
- spot.gid.should be_nil # eql(3384862)
224
+ it 'should parse geoid integer' do
225
+ expect(spot.gid).to be_nil # eql(3384862)
229
226
  end
230
227
 
231
- it "should parse name" do
232
- spot.name.should eql("Hidrolina")
233
- spot.ascii.should be_nil # eql("Hidrolina")
228
+ it 'should parse name' do
229
+ expect(spot.name).to eql('Hidrolina')
230
+ expect(spot.ascii).to be_nil # eql("Hidrolina")
234
231
  end
235
232
 
236
- it "should parse lat" do
237
- spot.lat.should be_within(0.001).of(-14.7574)
233
+ it 'should parse lat' do
234
+ expect(spot.lat).to be_within(0.001).of(-14.7574)
238
235
  end
239
236
 
240
- it "should parse lon" do
241
- spot.lon.should be_within(0.001).of(-49.3596)
237
+ it 'should parse lon' do
238
+ expect(spot.lon).to be_within(0.001).of(-49.3596)
242
239
  end
243
240
 
244
241
  end
245
242
 
246
- describe "From Hash" do
243
+ describe 'From Hash' do
247
244
 
248
- let(:spot) { Spot.from_hash({"id" => 9, "name" => "Sao Rock", "geom" => [15,15], "kind" => "city", "nation" => "BR", "gid" => 13232, "tz" => "America/Foo", "ascii" => "Rock"}) }
245
+ let(:spot) { Spot.from_hash('id' => 9, 'name' => 'Sao Rock', 'geom' => [15, 15], 'kind' => 'city', 'nation' => 'BR', 'gid' => 13_232, 'tz' => 'America/Foo', 'ascii' => 'Rock') }
249
246
 
250
- it "should be an spot" do
251
- spot.should be_instance_of Spot
247
+ it 'should be an spot' do
248
+ expect(spot).to be_instance_of Spot
252
249
  end
253
250
 
254
- it "should set the name" do
255
- spot.name.should eql("Sao Rock")
251
+ it 'should set the name' do
252
+ expect(spot.name).to eql('Sao Rock')
256
253
  end
257
254
 
258
- it "should set the geom" do
259
- spot.geom.should be_instance_of(GeoRuby::SimpleFeatures::Point)
260
- spot.geom.x.should eql(15)
255
+ it 'should set the geom' do
256
+ expect(spot.geom).to be_instance_of(GeoRuby::SimpleFeatures::Point)
257
+ expect(spot.geom.x).to eql(15)
261
258
  end
262
259
 
263
- it "should set the tz" do
264
- spot.tz.should eql("America/Foo")
260
+ it 'should set the tz' do
261
+ expect(spot.tz).to eql('America/Foo')
265
262
  end
266
263
 
267
- it "should set the ascii" do
268
- spot.ascii.should eql("Rock")
264
+ it 'should set the ascii' do
265
+ expect(spot.ascii).to eql('Rock')
269
266
  end
270
267
 
271
- it "should set the nation abbr" do
272
- spot.nation.should eql("BR")
268
+ it 'should set the nation abbr' do
269
+ expect(spot.nation).to eql('BR')
273
270
  end
274
271
 
275
272
  end
@@ -1,56 +1,55 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
- require "geo_ruby"
1
+ require 'spec_helper'
3
2
 
4
3
  describe Zone do
5
4
 
6
- describe "Parsing Dump" do
5
+ describe 'Parsing Dump' do
7
6
 
8
7
  before do
9
8
  @zone = Zone.new([:name, :null, :geom], "Copacabana\t2\t0106000020E6100000010000000103000020E6100000010000001B000000DE024322029645C0E3263B4536F736C06A78FF7D099745C05F4C17BC3AF836C016ECF835959745C0A6303C5AF6F836C031D79B0DEE9745C02A86A360EDF936C0BBC7A929259845C054515A9559FB36C0050527EF109845C02AD15A3969FC36C0A5705221BD9745C031151F7ACBFC36C0A96DC310049845C0055C26CBE0FC36C0C0FA3CDA6E9845C02424EED2F6FC36C08D80123FF49845C03C190018D7FB36C02E4C5C15199945C0A11ABD694CFB36C00D94B215269945C0F04B5E66CAFA36C03440A3EA169945C029ADE30D51FA36C082988494F89845C06DF6F65FD3F936C0E1CC3ABED39845C00B593959CFF836C0C0ED50117D9845C045937E53F2F736C03440A3EA169945C0CDFE644A93F636C0BA204AE9E29845C0C2EF96F233F636C08C60DFA8C29845C0A38B4DC61DF636C06DA128929D9845C03DE8AF4604F636C047CEF70F499845C08B67D19D49F636C0E87201390A9845C073BEF5F5B5F636C05F50930A799745C0B707094838F636C06CEAA05AAD9645C049A9FD439CF536C034760E48739645C0B9F4FBDC84F536C0F2A307AC159645C0CCEA3108E3F636C0DE024322029645C0E3263B4536F736C0")
10
9
  end
11
10
 
12
- it "should parse code" do
13
- @zone.name.should eql("Copacabana")
11
+ it 'should parse code' do
12
+ expect(@zone.name).to eql('Copacabana')
14
13
  end
15
14
 
16
- it "should parse kind" do
17
- @zone.kind.should eql(:zone)
15
+ it 'should parse kind' do
16
+ expect(@zone.kind).to eql(:zone)
18
17
  end
19
18
 
20
- it "should parse geom" do
21
- @zone.geom.should be_kind_of(GeoRuby::SimpleFeatures::MultiPolygon)
19
+ it 'should parse geom' do
20
+ expect(@zone.geom).to be_kind_of(GeoRuby::SimpleFeatures::MultiPolygon)
22
21
  end
23
22
 
24
- it "should have 1 geometry" do
25
- @zone.geom.should have(1).geometries
23
+ it 'should have 1 geometry' do
24
+ expect(@zone.geom.size).to eq(1)
26
25
  end
27
26
 
28
- it "should have 1 geometry polygon" do
27
+ it 'should have 1 geometry polygon' do
29
28
  geom = @zone.geom.geometries[0]
30
- geom.should be_kind_of(GeoRuby::SimpleFeatures::Polygon)
29
+ expect(geom).to be_kind_of(GeoRuby::SimpleFeatures::Polygon)
31
30
  end
32
31
 
33
- it "should have 1 geometry polygon with n points" do
34
- @zone.geom.geometries[0][0].should have(27).points
32
+ it 'should have 1 geometry polygon with n points' do
33
+ expect(@zone.geom.geometries[0][0].size).to eq(27)
35
34
  end
36
35
 
37
36
  end
38
37
 
39
- describe "Another parse" do
38
+ describe 'Another parse' do
40
39
  before do
41
40
  @zone = Zone.new([:name, :null, :geom], "Botafogo\t4\t0106000020E6100000010000000103000020E610000001000000260000008C60DFA8C29845C0A38B4DC61DF636C0D68132D5E79845C090FADA554EF536C069D119B12A9945C0D857001102F436C0298D2075189945C0BFEDCBEBA8F336C049DBDD0FFA9845C0EEE2E7537BF336C0D68132D5E79845C0C2DCE6FB5FF336C0A761EE3BB99845C0FD7DA07637F336C048D58ABADF9845C061341567FBF136C0D5CD0D24649845C01D4DDC69AEF136C0106FC79E3B9845C058EE95E485F136C0739E6AE14F9845C043737CCFE3F036C0C10619C0459845C0466297DF9AF036C0BD63D9FE0A9845C0AF6F70421DF036C0A8E8BFE9689745C022C3C82715F036C0AF7A1ABB5A9745C08103515A72F036C0805AD6212C9745C0A04BBB9F39F036C03FFE0258109745C0E861C12D4AF036C0FD2EA4E8CC9645C08103515A72F036C03F62B834969645C0A9913A22AFF036C0C96B208E639645C0875AB5CC30F136C02DFC02077A9645C03E01065281F136C0BD3A35D49B9645C04CFB74214EF136C04048B7CBD99645C0F0F4ABBE6EF136C0ABD7DAF91F9745C0521060C417F236C083C8D321229745C0BC1081D776F236C009643E7BF99645C083E4C80ECAF236C0D16BCFB3BF9645C0EFBC652AD8F236C084595B73599645C07CA67AEF3AF336C0B1592EAC6B9645C0A3A74E6AB4F336C03DAE50A9189645C0D653696356F436C02127B0EE3C9645C070D22BCB62F536C034760E48739645C0B9F4FBDC84F536C06CEAA05AAD9645C049A9FD439CF536C05F50930A799745C0B707094838F636C0E87201390A9845C073BEF5F5B5F636C047CEF70F499845C08B67D19D49F636C06DA128929D9845C03DE8AF4604F636C08C60DFA8C29845C0A38B4DC61DF636C0")
42
41
  end
43
42
 
44
- it "should parse code" do
45
- @zone.name.should eql("Botafogo")
43
+ it 'should parse code' do
44
+ expect(@zone.name).to eql('Botafogo')
46
45
  end
47
46
 
48
- it "should parse geom" do
49
- @zone.geom.should be_kind_of(GeoRuby::SimpleFeatures::MultiPolygon)
47
+ it 'should parse geom' do
48
+ expect(@zone.geom).to be_kind_of(GeoRuby::SimpleFeatures::MultiPolygon)
50
49
  end
51
50
 
52
- it "should have 1 geometry polygon with n points" do
53
- @zone.geom.geometries[0][0].should have(38).points
51
+ it 'should have 1 geometry polygon with n points' do
52
+ expect(@zone.geom.geometries[0][0].size).to eq(38)
54
53
  end
55
54
 
56
55
  end
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- require "spec_helper"
2
+ require 'spec_helper'
3
3
 
4
4
  # require 'geonames_local/models/mongodb'
5
5
  # include Models::Mongo
@@ -1,29 +1,29 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
- describe "Tokyo" do
3
+ describe 'Tokyo' do
4
4
 
5
- # it "should write down a spot" do
6
- # t = Geonames::Tokyo.new('localhost', 1978)
7
- # m = mock(Geonames::Spot, { :gid => 888, :to_hash => { "gid" => 888, "kind" => "city", "lat" => 5.5 }})
8
- # t.write(m)
9
- # end
5
+ # it "should write down a spot" do
6
+ # t = Geonames::Tokyo.new('localhost', 1978)
7
+ # m = mock(Geonames::Spot, { :gid => 888, :to_hash => { "gid" => 888, "kind" => "city", "lat" => 5.5 }})
8
+ # t.write(m)
9
+ # end
10
10
 
11
- # it "should read it up" do
12
- # t = Geonames::Tokyo.new('localhost', 1978)
13
- # record = t.find(888)
14
- # record.should be_instance_of Geonames::Spot
15
- # end
11
+ # it "should read it up" do
12
+ # t = Geonames::Tokyo.new('localhost', 1978)
13
+ # record = t.find(888)
14
+ # record.should be_instance_of Geonames::Spot
15
+ # end
16
16
 
17
- # it "should not duplicate" do
18
- # t = Geonames::Tokyo.new('localhost', 1978)
19
- # t.all({ :gid => 888}).length.should eql(1)
20
- # end
17
+ # it "should not duplicate" do
18
+ # t = Geonames::Tokyo.new('localhost', 1978)
19
+ # t.all({ :gid => 888}).length.should eql(1)
20
+ # end
21
21
 
22
- # it "should return all countries" do
23
- # all = Geonames::Nation.all
24
- # all.should be_instance_of Array
25
- # all[0].should be_instance_of Geonames::Nation
26
- # all[0].gid.should eql(1)
27
- # end
22
+ # it "should return all countries" do
23
+ # all = Geonames::Nation.all
24
+ # all.should be_instance_of Array
25
+ # all[0].should be_instance_of Geonames::Nation
26
+ # all[0].gid.should eql(1)
27
+ # end
28
28
 
29
29
  end
@@ -3,9 +3,8 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
 
4
4
  describe Geonames do
5
5
 
6
- it "should have a cache" do
7
- Cache.should be_instance_of(Hash)
6
+ it 'should have a cache' do
7
+ expect(Cache).to be_instance_of(Hash)
8
8
  end
9
9
 
10
-
11
10
  end
@@ -30,8 +30,6 @@
30
30
  # exit
31
31
  # end
32
32
 
33
-
34
-
35
33
  # ActiveRecord::Schema.define() do
36
34
 
37
35
  # create_table :users, :force => true do |t|
@@ -92,5 +90,4 @@
92
90
  # DatabaseCleaner.clean
93
91
  # end
94
92
 
95
-
96
93
  # end
data/spec/spec_helper.rb CHANGED
@@ -3,9 +3,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
  require 'geonames_local'
4
4
  require 'geonames_local/cli'
5
5
  require 'rspec'
6
- require 'rspec/autorun'
7
6
  include Geonames
8
7
 
9
- RSpec.configure do |config|
10
-
11
- end
8
+ # RSpec.configure do |config|
9
+ # end
data/task/benchmark.rb CHANGED
@@ -11,17 +11,15 @@ require 'geonames_local'
11
11
  def b1(db)
12
12
  puts "#{db.count} Objects"
13
13
  Benchmark.bmbm do |b|
14
- b.report("All Country") { db.all({ :kind => "country" })}
15
- b.report("Find by GID") { db.find(888) }
16
- b.report("Find by name") { db.all({ :name => "Maxaranguape"}) }
17
- b.report("Find on country") { db.all({ :country => "CL"}) }
14
+ b.report('All Country') { db.all(kind: 'country') }
15
+ b.report('Find by GID') { db.find(888) }
16
+ b.report('Find by name') { db.all(name: 'Maxaranguape') }
17
+ b.report('Find on country') { db.all(country: 'CL') }
18
18
  end
19
19
  end
20
20
 
21
- print "Tyrant => "
21
+ print 'Tyrant => '
22
22
  b1(Geonames::Tokyo.new(:tyrant))
23
23
 
24
-
25
- print "Cabinet => "
24
+ print 'Cabinet => '
26
25
  b1(Geonames::Tokyo.new)
27
-
@@ -8,17 +8,15 @@ require 'geonames_local'
8
8
  include Geonames
9
9
  # @db.flush
10
10
 
11
-
12
11
  def b1(db)
13
12
  puts "#{db.count} Objects"
14
13
  Benchmark.bmbm do |b|
15
- b.report("All Country") { Country.all }
16
- b.report("Find by GID") { db.find(888) }
17
- b.report("Find by name") { db.all({ :name => "Maxaranguape"}) }
18
- b.report("Find on country") { db.all({ :country => "CL"}) }
14
+ b.report('All Country') { Country.all }
15
+ b.report('Find by GID') { db.find(888) }
16
+ b.report('Find by name') { db.all(name: 'Maxaranguape') }
17
+ b.report('Find on country') { db.all(country: 'CL') }
19
18
  end
20
19
  end
21
20
 
22
- print "Cabinet => "
21
+ print 'Cabinet => '
23
22
  b1(Tokyo.new)
24
-