earth 0.11.14 → 0.11.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ class FlightDistanceClass < ActiveRecord::Base
2
2
  self.primary_key = "name"
3
3
 
4
4
  def self.find_by_distance(distance)
5
- first :conditions => arel_table[:min_distance].lteq(distance.to_f).and(arel_table[:max_distance].gt(distance.to_f))
5
+ first :conditions => arel_table[:min_distance].lt(distance.to_f).and(arel_table[:max_distance].gteq(distance.to_f))
6
6
  end
7
7
 
8
8
  col :name
data/lib/earth/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Earth
2
- VERSION = "0.11.14"
2
+ VERSION = "0.11.15"
3
3
  end
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+ require 'earth/air/flight_distance_class'
3
+
4
+ describe FlightDistanceClass do
5
+ before :all do
6
+ FlightDistanceClass.auto_upgrade!
7
+ end
8
+
9
+ describe "when importing data", :data_miner => true do
10
+ before do
11
+ require 'earth/air/flight_distance_class/data_miner'
12
+ end
13
+
14
+ it "imports all naics codes" do
15
+ FlightDistanceClass.run_data_miner!
16
+ FlightDistanceClass.count.should == 2
17
+ end
18
+ end
19
+
20
+ describe "verify imported data", :sanity => true do
21
+ it "should have distances > 0" do
22
+ FlightDistanceClass.where('distance <= 0 OR distance IS NULL').count.should == 0
23
+ end
24
+
25
+ it "the smallest min distance should be 0" do
26
+ FlightDistanceClass.all.map(&:min_distance).min.should == 0
27
+ end
28
+
29
+ it "the largest max distance should be half the earth's circumference" do
30
+ FlightDistanceClass.all.map(&:max_distance).max.should == 20037.6
31
+ end
32
+ end
33
+
34
+ describe ".find_by_distance" do
35
+ it "should return a distance class where min distance > distance and max distance <= distance" do
36
+ distance_class = FlightDistanceClass.find_by_distance(3700)
37
+ distance_class.min_distance.should < 3700
38
+ distance_class.max_distance.should >= 3700
39
+ end
40
+
41
+ it "should return nil unless distance between 0 and half the earth's circumference" do
42
+ FlightDistanceClass.find_by_distance(-1000).should be_nil
43
+ FlightDistanceClass.find_by_distance(0).should be_nil
44
+ FlightDistanceClass.find_by_distance(20037.61).should be_nil
45
+ end
46
+ end
47
+ end
@@ -25,7 +25,7 @@ describe CountryLodgingClass do
25
25
  end
26
26
 
27
27
  it "should have the correct total weighting for the US" do
28
- CountryLodgingClass.where(:country_iso_3166_code => 'US').sum(&:weighting).should == be_within(0.0001).of(89209.27734)
28
+ CountryLodgingClass.where(:country_iso_3166_code => 'US').sum(&:weighting).should == be_within(0.1).of(89209.2)
29
29
  end
30
30
  end
31
31
  end
metadata CHANGED
@@ -1,292 +1,294 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: earth
3
- version: !ruby/object:Gem::Version
4
- version: 0.11.14
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.11.15
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Seamus Abshere
9
9
  - Derek Kastner
10
10
  - Andy Rossmeissl
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-03-26 00:00:00.000000000 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
14
+
15
+ date: 2012-03-27 00:00:00 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
17
18
  name: activerecord
18
- requirement: &2165356220 !ruby/object:Gem::Requirement
19
+ requirement: &id001 !ruby/object:Gem::Requirement
19
20
  none: false
20
- requirements:
21
- - - ! '>='
22
- - !ruby/object:Gem::Version
23
- version: '0'
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
24
25
  type: :runtime
25
26
  prerelease: false
26
- version_requirements: *2165356220
27
- - !ruby/object:Gem::Dependency
27
+ version_requirements: *id001
28
+ - !ruby/object:Gem::Dependency
28
29
  name: activesupport
29
- requirement: &2165355780 !ruby/object:Gem::Requirement
30
+ requirement: &id002 !ruby/object:Gem::Requirement
30
31
  none: false
31
- requirements:
32
- - - ! '>='
33
- - !ruby/object:Gem::Version
34
- version: '0'
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
35
36
  type: :runtime
36
37
  prerelease: false
37
- version_requirements: *2165355780
38
- - !ruby/object:Gem::Dependency
38
+ version_requirements: *id002
39
+ - !ruby/object:Gem::Dependency
39
40
  name: cohort_analysis
40
- requirement: &2165355360 !ruby/object:Gem::Requirement
41
+ requirement: &id003 !ruby/object:Gem::Requirement
41
42
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
46
47
  type: :runtime
47
48
  prerelease: false
48
- version_requirements: *2165355360
49
- - !ruby/object:Gem::Dependency
49
+ version_requirements: *id003
50
+ - !ruby/object:Gem::Dependency
50
51
  name: conversions
51
- requirement: &2165370800 !ruby/object:Gem::Requirement
52
+ requirement: &id004 !ruby/object:Gem::Requirement
52
53
  none: false
53
- requirements:
54
- - - ! '>='
55
- - !ruby/object:Gem::Version
56
- version: '0'
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
57
58
  type: :runtime
58
59
  prerelease: false
59
- version_requirements: *2165370800
60
- - !ruby/object:Gem::Dependency
60
+ version_requirements: *id004
61
+ - !ruby/object:Gem::Dependency
61
62
  name: data_miner
62
- requirement: &2165370300 !ruby/object:Gem::Requirement
63
+ requirement: &id005 !ruby/object:Gem::Requirement
63
64
  none: false
64
- requirements:
65
- - - ! '>='
66
- - !ruby/object:Gem::Version
67
- version: '1.3'
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "1.3"
68
69
  type: :runtime
69
70
  prerelease: false
70
- version_requirements: *2165370300
71
- - !ruby/object:Gem::Dependency
71
+ version_requirements: *id005
72
+ - !ruby/object:Gem::Dependency
72
73
  name: falls_back_on
73
- requirement: &2165369760 !ruby/object:Gem::Requirement
74
+ requirement: &id006 !ruby/object:Gem::Requirement
74
75
  none: false
75
- requirements:
76
- - - ! '>='
77
- - !ruby/object:Gem::Version
78
- version: '0'
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
79
80
  type: :runtime
80
81
  prerelease: false
81
- version_requirements: *2165369760
82
- - !ruby/object:Gem::Dependency
82
+ version_requirements: *id006
83
+ - !ruby/object:Gem::Dependency
83
84
  name: fixed_width-multibyte
84
- requirement: &2165369300 !ruby/object:Gem::Requirement
85
+ requirement: &id007 !ruby/object:Gem::Requirement
85
86
  none: false
86
- requirements:
87
- - - ! '>='
88
- - !ruby/object:Gem::Version
89
- version: '0'
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
90
91
  type: :runtime
91
92
  prerelease: false
92
- version_requirements: *2165369300
93
- - !ruby/object:Gem::Dependency
93
+ version_requirements: *id007
94
+ - !ruby/object:Gem::Dependency
94
95
  name: fuzzy_match
95
- requirement: &2165368800 !ruby/object:Gem::Requirement
96
+ requirement: &id008 !ruby/object:Gem::Requirement
96
97
  none: false
97
- requirements:
98
- - - ! '>='
99
- - !ruby/object:Gem::Version
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
100
101
  version: 1.1.0
101
102
  type: :runtime
102
103
  prerelease: false
103
- version_requirements: *2165368800
104
- - !ruby/object:Gem::Dependency
104
+ version_requirements: *id008
105
+ - !ruby/object:Gem::Dependency
105
106
  name: geokit
106
- requirement: &2165368360 !ruby/object:Gem::Requirement
107
+ requirement: &id009 !ruby/object:Gem::Requirement
107
108
  none: false
108
- requirements:
109
- - - ! '>='
110
- - !ruby/object:Gem::Version
111
- version: '0'
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: "0"
112
113
  type: :runtime
113
114
  prerelease: false
114
- version_requirements: *2165368360
115
- - !ruby/object:Gem::Dependency
115
+ version_requirements: *id009
116
+ - !ruby/object:Gem::Dependency
116
117
  name: active_record_inline_schema
117
- requirement: &2165367900 !ruby/object:Gem::Requirement
118
+ requirement: &id010 !ruby/object:Gem::Requirement
118
119
  none: false
119
- requirements:
120
- - - ! '>='
121
- - !ruby/object:Gem::Version
122
- version: '0'
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: "0"
123
124
  type: :runtime
124
125
  prerelease: false
125
- version_requirements: *2165367900
126
- - !ruby/object:Gem::Dependency
126
+ version_requirements: *id010
127
+ - !ruby/object:Gem::Dependency
127
128
  name: remote_table
128
- requirement: &2165367380 !ruby/object:Gem::Requirement
129
+ requirement: &id011 !ruby/object:Gem::Requirement
129
130
  none: false
130
- requirements:
131
- - - ! '>='
132
- - !ruby/object:Gem::Version
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
133
134
  version: 1.3.0
134
135
  type: :runtime
135
136
  prerelease: false
136
- version_requirements: *2165367380
137
- - !ruby/object:Gem::Dependency
137
+ version_requirements: *id011
138
+ - !ruby/object:Gem::Dependency
138
139
  name: table_warnings
139
- requirement: &2165366880 !ruby/object:Gem::Requirement
140
+ requirement: &id012 !ruby/object:Gem::Requirement
140
141
  none: false
141
- requirements:
142
- - - ! '>='
143
- - !ruby/object:Gem::Version
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
144
145
  version: 0.0.6
145
146
  type: :runtime
146
147
  prerelease: false
147
- version_requirements: *2165366880
148
- - !ruby/object:Gem::Dependency
148
+ version_requirements: *id012
149
+ - !ruby/object:Gem::Dependency
149
150
  name: to_regexp
150
- requirement: &2165366500 !ruby/object:Gem::Requirement
151
+ requirement: &id013 !ruby/object:Gem::Requirement
151
152
  none: false
152
- requirements:
153
- - - ! '>='
154
- - !ruby/object:Gem::Version
155
- version: '0'
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: "0"
156
157
  type: :runtime
157
158
  prerelease: false
158
- version_requirements: *2165366500
159
- - !ruby/object:Gem::Dependency
159
+ version_requirements: *id013
160
+ - !ruby/object:Gem::Dependency
160
161
  name: weighted_average
161
- requirement: &2165365960 !ruby/object:Gem::Requirement
162
+ requirement: &id014 !ruby/object:Gem::Requirement
162
163
  none: false
163
- requirements:
164
- - - ! '>='
165
- - !ruby/object:Gem::Version
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
166
167
  version: 1.0.2
167
168
  type: :runtime
168
169
  prerelease: false
169
- version_requirements: *2165365960
170
- - !ruby/object:Gem::Dependency
170
+ version_requirements: *id014
171
+ - !ruby/object:Gem::Dependency
171
172
  name: bueller
172
- requirement: &2165365500 !ruby/object:Gem::Requirement
173
+ requirement: &id015 !ruby/object:Gem::Requirement
173
174
  none: false
174
- requirements:
175
- - - ! '>='
176
- - !ruby/object:Gem::Version
177
- version: '0'
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: "0"
178
179
  type: :development
179
180
  prerelease: false
180
- version_requirements: *2165365500
181
- - !ruby/object:Gem::Dependency
181
+ version_requirements: *id015
182
+ - !ruby/object:Gem::Dependency
182
183
  name: bundler
183
- requirement: &2165365020 !ruby/object:Gem::Requirement
184
+ requirement: &id016 !ruby/object:Gem::Requirement
184
185
  none: false
185
- requirements:
186
- - - ! '>='
187
- - !ruby/object:Gem::Version
188
- version: '0'
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: "0"
189
190
  type: :development
190
191
  prerelease: false
191
- version_requirements: *2165365020
192
- - !ruby/object:Gem::Dependency
192
+ version_requirements: *id016
193
+ - !ruby/object:Gem::Dependency
193
194
  name: charisma
194
- requirement: &2165364520 !ruby/object:Gem::Requirement
195
+ requirement: &id017 !ruby/object:Gem::Requirement
195
196
  none: false
196
- requirements:
197
- - - ! '>='
198
- - !ruby/object:Gem::Version
199
- version: '0'
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: "0"
200
201
  type: :development
201
202
  prerelease: false
202
- version_requirements: *2165364520
203
- - !ruby/object:Gem::Dependency
203
+ version_requirements: *id017
204
+ - !ruby/object:Gem::Dependency
204
205
  name: cucumber
205
- requirement: &2165364020 !ruby/object:Gem::Requirement
206
+ requirement: &id018 !ruby/object:Gem::Requirement
206
207
  none: false
207
- requirements:
208
- - - ! '>='
209
- - !ruby/object:Gem::Version
210
- version: '0'
208
+ requirements:
209
+ - - ">="
210
+ - !ruby/object:Gem::Version
211
+ version: "0"
211
212
  type: :development
212
213
  prerelease: false
213
- version_requirements: *2165364020
214
- - !ruby/object:Gem::Dependency
214
+ version_requirements: *id018
215
+ - !ruby/object:Gem::Dependency
215
216
  name: mysql2
216
- requirement: &2165379760 !ruby/object:Gem::Requirement
217
+ requirement: &id019 !ruby/object:Gem::Requirement
217
218
  none: false
218
- requirements:
219
- - - ! '>='
220
- - !ruby/object:Gem::Version
221
- version: '0'
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: "0"
222
223
  type: :development
223
224
  prerelease: false
224
- version_requirements: *2165379760
225
- - !ruby/object:Gem::Dependency
225
+ version_requirements: *id019
226
+ - !ruby/object:Gem::Dependency
226
227
  name: pg
227
- requirement: &2165379300 !ruby/object:Gem::Requirement
228
+ requirement: &id020 !ruby/object:Gem::Requirement
228
229
  none: false
229
- requirements:
230
- - - ! '>='
231
- - !ruby/object:Gem::Version
232
- version: '0'
230
+ requirements:
231
+ - - ">="
232
+ - !ruby/object:Gem::Version
233
+ version: "0"
233
234
  type: :development
234
235
  prerelease: false
235
- version_requirements: *2165379300
236
- - !ruby/object:Gem::Dependency
236
+ version_requirements: *id020
237
+ - !ruby/object:Gem::Dependency
237
238
  name: rake
238
- requirement: &2165378880 !ruby/object:Gem::Requirement
239
+ requirement: &id021 !ruby/object:Gem::Requirement
239
240
  none: false
240
- requirements:
241
- - - ! '>='
242
- - !ruby/object:Gem::Version
243
- version: '0'
241
+ requirements:
242
+ - - ">="
243
+ - !ruby/object:Gem::Version
244
+ version: "0"
244
245
  type: :development
245
246
  prerelease: false
246
- version_requirements: *2165378880
247
- - !ruby/object:Gem::Dependency
247
+ version_requirements: *id021
248
+ - !ruby/object:Gem::Dependency
248
249
  name: rdoc
249
- requirement: &2165378460 !ruby/object:Gem::Requirement
250
+ requirement: &id022 !ruby/object:Gem::Requirement
250
251
  none: false
251
- requirements:
252
- - - ! '>='
253
- - !ruby/object:Gem::Version
254
- version: '0'
252
+ requirements:
253
+ - - ">="
254
+ - !ruby/object:Gem::Version
255
+ version: "0"
255
256
  type: :development
256
257
  prerelease: false
257
- version_requirements: *2165378460
258
- - !ruby/object:Gem::Dependency
258
+ version_requirements: *id022
259
+ - !ruby/object:Gem::Dependency
259
260
  name: rspec
260
- requirement: &2165378040 !ruby/object:Gem::Requirement
261
+ requirement: &id023 !ruby/object:Gem::Requirement
261
262
  none: false
262
- requirements:
263
- - - ! '>='
264
- - !ruby/object:Gem::Version
265
- version: '0'
263
+ requirements:
264
+ - - ">="
265
+ - !ruby/object:Gem::Version
266
+ version: "0"
266
267
  type: :development
267
268
  prerelease: false
268
- version_requirements: *2165378040
269
- - !ruby/object:Gem::Dependency
269
+ version_requirements: *id023
270
+ - !ruby/object:Gem::Dependency
270
271
  name: sqlite3-ruby
271
- requirement: &2165377620 !ruby/object:Gem::Requirement
272
+ requirement: &id024 !ruby/object:Gem::Requirement
272
273
  none: false
273
- requirements:
274
- - - ! '>='
275
- - !ruby/object:Gem::Version
276
- version: '0'
274
+ requirements:
275
+ - - ">="
276
+ - !ruby/object:Gem::Version
277
+ version: "0"
277
278
  type: :development
278
279
  prerelease: false
279
- version_requirements: *2165377620
280
+ version_requirements: *id024
280
281
  description: An earth-simulation environment with ActiveRecord models and data
281
282
  email: andy@rossmeissl.net
282
- executables:
283
+ executables:
283
284
  - earth_tester.rb
284
285
  extensions: []
285
- extra_rdoc_files:
286
+
287
+ extra_rdoc_files:
286
288
  - LICENSE
287
289
  - LICENSE-PREAMBLE
288
290
  - README.markdown
289
- files:
291
+ files:
290
292
  - .gitignore
291
293
  - Gemfile
292
294
  - Guardfile
@@ -604,6 +606,7 @@ files:
604
606
  - lib/earth/utils.rb
605
607
  - lib/earth/version.rb
606
608
  - spec/earth/air/aircraft_spec.rb
609
+ - spec/earth/air/flight_distance_class_spec.rb
607
610
  - spec/earth/automobile/automobile_fuel_spec.rb
608
611
  - spec/earth/automobile/automobile_type_fuel_year_age_spec.rb
609
612
  - spec/earth/bus/bus_class_spec.rb
@@ -675,30 +678,38 @@ files:
675
678
  - vendor/geokit-rails/test/test_helper.rb
676
679
  homepage: https://github.com/brighterplanet/earth
677
680
  licenses: []
681
+
678
682
  post_install_message:
679
- rdoc_options:
683
+ rdoc_options:
680
684
  - --charset=UTF-8
681
- require_paths:
685
+ require_paths:
682
686
  - lib
683
- required_ruby_version: !ruby/object:Gem::Requirement
687
+ required_ruby_version: !ruby/object:Gem::Requirement
684
688
  none: false
685
- requirements:
686
- - - ! '>='
687
- - !ruby/object:Gem::Version
688
- version: '0'
689
- required_rubygems_version: !ruby/object:Gem::Requirement
689
+ requirements:
690
+ - - ">="
691
+ - !ruby/object:Gem::Version
692
+ hash: 3248101805049247175
693
+ segments:
694
+ - 0
695
+ version: "0"
696
+ required_rubygems_version: !ruby/object:Gem::Requirement
690
697
  none: false
691
- requirements:
692
- - - ! '>='
693
- - !ruby/object:Gem::Version
694
- version: '0'
698
+ requirements:
699
+ - - ">="
700
+ - !ruby/object:Gem::Version
701
+ hash: 3248101805049247175
702
+ segments:
703
+ - 0
704
+ version: "0"
695
705
  requirements: []
706
+
696
707
  rubyforge_project:
697
708
  rubygems_version: 1.8.15
698
709
  signing_key:
699
710
  specification_version: 3
700
711
  summary: Land, sky, and sea
701
- test_files:
712
+ test_files:
702
713
  - features/automobile_fuel.feature
703
714
  - features/automobile_make.feature
704
715
  - features/automobile_make_fleet_year.feature
@@ -782,6 +793,7 @@ test_files:
782
793
  - features/support/imports/shipment_mode_bad.csv
783
794
  - features/support/imports/shipment_mode_good.csv
784
795
  - spec/earth/air/aircraft_spec.rb
796
+ - spec/earth/air/flight_distance_class_spec.rb
785
797
  - spec/earth/automobile/automobile_fuel_spec.rb
786
798
  - spec/earth/automobile/automobile_type_fuel_year_age_spec.rb
787
799
  - spec/earth/bus/bus_class_spec.rb
@@ -806,4 +818,3 @@ test_files:
806
818
  - spec/earth_spec.rb
807
819
  - spec/spec_helper.rb
808
820
  - spec/support/integration.rb
809
- has_rdoc: