earth 0.11.10 → 0.11.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/Gemfile +4 -0
  2. data/Guardfile +35 -0
  3. data/README.markdown +94 -20
  4. data/Rakefile +4 -0
  5. data/earth.gemspec +14 -12
  6. data/lib/earth/air/aircraft.rb +2 -2
  7. data/lib/earth/air/aircraft_instance.rb +2 -2
  8. data/lib/earth/air/aircraft_instance_seat_class.rb +2 -2
  9. data/lib/earth/air/airline.rb +2 -2
  10. data/lib/earth/air/airport.rb +2 -2
  11. data/lib/earth/air/bts_aircraft.rb +2 -2
  12. data/lib/earth/air/flight_distance_class.rb +1 -1
  13. data/lib/earth/air/flight_distance_class_seat_class.rb +1 -1
  14. data/lib/earth/air/flight_seat_class.rb +1 -1
  15. data/lib/earth/air/flight_segment.rb +1 -1
  16. data/lib/earth/automobile/automobile_fuel.rb +1 -1
  17. data/lib/earth/automobile/automobile_make.rb +1 -1
  18. data/lib/earth/automobile/automobile_make_model.rb +1 -1
  19. data/lib/earth/automobile/automobile_make_model_year.rb +1 -1
  20. data/lib/earth/automobile/automobile_make_model_year_variant.rb +1 -1
  21. data/lib/earth/automobile/automobile_make_year.rb +1 -1
  22. data/lib/earth/automobile/automobile_make_year_fleet.rb +1 -1
  23. data/lib/earth/automobile/automobile_model.rb +1 -1
  24. data/lib/earth/automobile/automobile_size_class.rb +1 -1
  25. data/lib/earth/automobile/automobile_size_class_year.rb +1 -1
  26. data/lib/earth/automobile/automobile_type_fuel_control.rb +1 -1
  27. data/lib/earth/automobile/automobile_type_fuel_year.rb +1 -1
  28. data/lib/earth/automobile/automobile_type_fuel_year_age.rb +1 -1
  29. data/lib/earth/automobile/automobile_type_fuel_year_control.rb +1 -1
  30. data/lib/earth/automobile/automobile_type_year.rb +2 -2
  31. data/lib/earth/automobile/automobile_year.rb +1 -1
  32. data/lib/earth/bus/bus_class.rb +1 -1
  33. data/lib/earth/bus/bus_fuel.rb +2 -2
  34. data/lib/earth/bus/bus_fuel_control.rb +2 -2
  35. data/lib/earth/bus/bus_fuel_year_control.rb +2 -2
  36. data/lib/earth/computation/computation_carrier.rb +2 -2
  37. data/lib/earth/computation/computation_carrier_instance_class.rb +2 -2
  38. data/lib/earth/computation/computation_carrier_region.rb +2 -2
  39. data/lib/earth/conversions_ext.rb +26 -7
  40. data/lib/earth/diet/diet_class.rb +2 -2
  41. data/lib/earth/diet/food_group.rb +2 -2
  42. data/lib/earth/eia.rb +13 -13
  43. data/lib/earth/fuel/fuel.rb +22 -13
  44. data/lib/earth/fuel/fuel/data_miner.rb +36 -44
  45. data/lib/earth/fuel/fuel_price.rb +1 -1
  46. data/lib/earth/fuel/fuel_type.rb +2 -2
  47. data/lib/earth/fuel/fuel_year.rb +4 -2
  48. data/lib/earth/fuel/greenhouse_gas.rb +2 -2
  49. data/lib/earth/hospitality/commercial_building_energy_consumption_survey_response.rb +14 -5
  50. data/lib/earth/hospitality/commercial_building_energy_consumption_survey_response/data_miner.rb +22 -1
  51. data/lib/earth/hospitality/country_lodging_class.rb +3 -3
  52. data/lib/earth/hospitality/country_lodging_class/data_miner.rb +7 -5
  53. data/lib/earth/hospitality/lodging_class.rb +1 -1
  54. data/lib/earth/hospitality/lodging_property.rb +8 -8
  55. data/lib/earth/industry/cbecs_energy_intensity.rb +59 -6
  56. data/lib/earth/industry/cbecs_energy_intensity/data_miner.rb +266 -69
  57. data/lib/earth/industry/industry.rb +1 -1
  58. data/lib/earth/industry/industry_product.rb +2 -2
  59. data/lib/earth/industry/industry_product_line.rb +2 -2
  60. data/lib/earth/industry/industry_sector.rb +2 -2
  61. data/lib/earth/industry/mecs_energy.rb +26 -15
  62. data/lib/earth/industry/mecs_energy/data_miner.rb +39 -23
  63. data/lib/earth/industry/mecs_ratio.rb +13 -10
  64. data/lib/earth/industry/mecs_ratio/data_miner.rb +14 -14
  65. data/lib/earth/industry/merchant.rb +2 -2
  66. data/lib/earth/industry/merchant_category.rb +2 -2
  67. data/lib/earth/industry/merchant_category_industry.rb +2 -2
  68. data/lib/earth/industry/product_line.rb +2 -2
  69. data/lib/earth/industry/product_line_industry_product.rb +2 -2
  70. data/lib/earth/industry/sector.rb +2 -2
  71. data/lib/earth/locality/census_division.rb +2 -2
  72. data/lib/earth/locality/census_division/data_miner.rb +4 -14
  73. data/lib/earth/locality/census_region.rb +2 -2
  74. data/lib/earth/locality/climate_division.rb +1 -17
  75. data/lib/earth/locality/country.rb +14 -28
  76. data/lib/earth/locality/country/data_miner.rb +8 -2
  77. data/lib/earth/locality/egrid_country.rb +1 -1
  78. data/lib/earth/locality/egrid_region.rb +4 -1
  79. data/lib/earth/locality/egrid_region/data_miner.rb +4 -1
  80. data/lib/earth/locality/egrid_subregion.rb +1 -1
  81. data/lib/earth/locality/egrid_subregion/data_miner.rb +1 -0
  82. data/lib/earth/locality/petroleum_administration_for_defense_district.rb +3 -3
  83. data/lib/earth/locality/state.rb +2 -7
  84. data/lib/earth/locality/zip_code.rb +1 -1
  85. data/lib/earth/pet/breed.rb +2 -2
  86. data/lib/earth/pet/breed_gender.rb +2 -2
  87. data/lib/earth/pet/gender.rb +2 -2
  88. data/lib/earth/pet/species.rb +2 -2
  89. data/lib/earth/pet/species/data_miner.rb +0 -9
  90. data/lib/earth/rail/country_rail_class.rb +1 -1
  91. data/lib/earth/rail/country_rail_traction.rb +1 -1
  92. data/lib/earth/rail/country_rail_traction_class.rb +1 -1
  93. data/lib/earth/rail/national_transit_database_company.rb +2 -2
  94. data/lib/earth/rail/national_transit_database_mode.rb +2 -2
  95. data/lib/earth/rail/national_transit_database_record.rb +2 -2
  96. data/lib/earth/rail/national_transit_database_record/data_miner.rb +12 -33
  97. data/lib/earth/rail/rail_class.rb +1 -1
  98. data/lib/earth/rail/rail_company.rb +1 -1
  99. data/lib/earth/rail/rail_company_traction.rb +1 -1
  100. data/lib/earth/rail/rail_company_traction_class.rb +1 -1
  101. data/lib/earth/rail/rail_fuel.rb +1 -1
  102. data/lib/earth/rail/rail_traction.rb +1 -1
  103. data/lib/earth/residence/air_conditioner_use.rb +2 -2
  104. data/lib/earth/residence/clothes_machine_use.rb +2 -2
  105. data/lib/earth/residence/dishwasher_use.rb +2 -2
  106. data/lib/earth/residence/residence_appliance.rb +2 -2
  107. data/lib/earth/residence/residence_class.rb +2 -2
  108. data/lib/earth/residence/residence_fuel_price.rb +2 -2
  109. data/lib/earth/residence/residence_fuel_price/data_miner.rb +0 -5
  110. data/lib/earth/residence/residence_fuel_type.rb +2 -2
  111. data/lib/earth/residence/residential_energy_consumption_survey_response.rb +3 -3
  112. data/lib/earth/residence/residential_energy_consumption_survey_response/data_miner.rb +0 -5
  113. data/lib/earth/residence/urbanity.rb +2 -2
  114. data/lib/earth/shipping/carrier.rb +3 -2
  115. data/lib/earth/shipping/carrier/data_miner.rb +1 -0
  116. data/lib/earth/shipping/carrier_mode.rb +2 -2
  117. data/lib/earth/shipping/shipment_mode.rb +2 -2
  118. data/lib/earth/version.rb +1 -1
  119. data/spec/earth/air/aircraft_spec.rb +421 -0
  120. data/spec/earth/fuel/fuel_spec.rb +35 -0
  121. data/spec/earth/hospitality/lodging_fuel_use_equation_spec.rb +96 -0
  122. data/spec/earth/industry/cbecs_energy_intensity_spec.rb +102 -0
  123. data/spec/earth/industry/mecs_energy_spec.rb +36 -44
  124. data/spec/earth/industry/mecs_ratio_spec.rb +24 -17
  125. data/spec/earth/locality/country_spec.rb +0 -9
  126. data/spec/spec_helper.rb +8 -3
  127. data/spec/support/integration.rb +17 -0
  128. data/vendor/geokit-rails/init.rb +2 -1
  129. data/vendor/geokit-rails/lib/geokit-rails.rb +1 -0
  130. metadata +63 -36
  131. data/lib/earth/hospitality/lodging_fuel_use_equation.rb +0 -26
  132. data/lib/earth/hospitality/lodging_fuel_use_equation/data_miner.rb +0 -20
  133. data/test/test_aircraft_match.rb +0 -732
@@ -1 +1,2 @@
1
- require 'geokit-rails'
1
+ # rather than unvendor this, let's try to get rid of the acts_as_mappable dependency (?)
2
+ require File.expand_path('../lib/geokit-rails', __FILE__)
@@ -7,6 +7,7 @@
7
7
  #
8
8
  require 'geokit'
9
9
  if defined? Geokit
10
+ # rather than unvendor this, let's try to get rid of the acts_as_mappable dependency (?)
10
11
  require File.expand_path('../geokit-rails/defaults', __FILE__)
11
12
  require File.expand_path('../geokit-rails/adapters/abstract', __FILE__)
12
13
  require File.expand_path('../geokit-rails/acts_as_mappable', __FILE__)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: earth
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.11.10
5
+ version: 0.11.11
6
6
  platform: ruby
7
7
  authors:
8
8
  - Seamus Abshere
@@ -12,21 +12,21 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2012-01-26 00:00:00 Z
15
+ date: 2012-02-15 00:00:00 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
- name: data_miner
18
+ name: activerecord
19
19
  requirement: &id001 !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: "1.3"
24
+ version: "0"
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: *id001
28
28
  - !ruby/object:Gem::Dependency
29
- name: to_regexp
29
+ name: activesupport
30
30
  requirement: &id002 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
@@ -48,24 +48,24 @@ dependencies:
48
48
  prerelease: false
49
49
  version_requirements: *id003
50
50
  - !ruby/object:Gem::Dependency
51
- name: table_warnings
51
+ name: conversions
52
52
  requirement: &id004 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ">="
56
56
  - !ruby/object:Gem::Version
57
- version: 0.0.6
57
+ version: "0"
58
58
  type: :runtime
59
59
  prerelease: false
60
60
  version_requirements: *id004
61
61
  - !ruby/object:Gem::Dependency
62
- name: remote_table
62
+ name: data_miner
63
63
  requirement: &id005 !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 1.3.0
68
+ version: "1.3"
69
69
  type: :runtime
70
70
  prerelease: false
71
71
  version_requirements: *id005
@@ -92,62 +92,62 @@ dependencies:
92
92
  prerelease: false
93
93
  version_requirements: *id007
94
94
  - !ruby/object:Gem::Dependency
95
- name: geokit
95
+ name: fuzzy_match
96
96
  requirement: &id008 !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
99
  - - ">="
100
100
  - !ruby/object:Gem::Version
101
- version: "0"
101
+ version: 1.1.0
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: *id008
105
105
  - !ruby/object:Gem::Dependency
106
- name: fuzzy_match
106
+ name: geokit
107
107
  requirement: &id009 !ruby/object:Gem::Requirement
108
108
  none: false
109
109
  requirements:
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
- version: 1.1.0
112
+ version: "0"
113
113
  type: :runtime
114
114
  prerelease: false
115
115
  version_requirements: *id009
116
116
  - !ruby/object:Gem::Dependency
117
- name: weighted_average
117
+ name: mini_record-compat
118
118
  requirement: &id010 !ruby/object:Gem::Requirement
119
119
  none: false
120
120
  requirements:
121
121
  - - ">="
122
122
  - !ruby/object:Gem::Version
123
- version: 1.0.2
123
+ version: "0"
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: *id010
127
127
  - !ruby/object:Gem::Dependency
128
- name: mini_record-compat
128
+ name: remote_table
129
129
  requirement: &id011 !ruby/object:Gem::Requirement
130
130
  none: false
131
131
  requirements:
132
132
  - - ">="
133
133
  - !ruby/object:Gem::Version
134
- version: "0"
134
+ version: 1.3.0
135
135
  type: :runtime
136
136
  prerelease: false
137
137
  version_requirements: *id011
138
138
  - !ruby/object:Gem::Dependency
139
- name: activesupport
139
+ name: table_warnings
140
140
  requirement: &id012 !ruby/object:Gem::Requirement
141
141
  none: false
142
142
  requirements:
143
143
  - - ">="
144
144
  - !ruby/object:Gem::Version
145
- version: "0"
145
+ version: 0.0.6
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: *id012
149
149
  - !ruby/object:Gem::Dependency
150
- name: activerecord
150
+ name: to_regexp
151
151
  requirement: &id013 !ruby/object:Gem::Requirement
152
152
  none: false
153
153
  requirements:
@@ -158,14 +158,14 @@ dependencies:
158
158
  prerelease: false
159
159
  version_requirements: *id013
160
160
  - !ruby/object:Gem::Dependency
161
- name: bundler
161
+ name: weighted_average
162
162
  requirement: &id014 !ruby/object:Gem::Requirement
163
163
  none: false
164
164
  requirements:
165
165
  - - ">="
166
166
  - !ruby/object:Gem::Version
167
- version: "0"
168
- type: :development
167
+ version: 1.0.2
168
+ type: :runtime
169
169
  prerelease: false
170
170
  version_requirements: *id014
171
171
  - !ruby/object:Gem::Dependency
@@ -180,7 +180,7 @@ dependencies:
180
180
  prerelease: false
181
181
  version_requirements: *id015
182
182
  - !ruby/object:Gem::Dependency
183
- name: cucumber
183
+ name: bundler
184
184
  requirement: &id016 !ruby/object:Gem::Requirement
185
185
  none: false
186
186
  requirements:
@@ -191,7 +191,7 @@ dependencies:
191
191
  prerelease: false
192
192
  version_requirements: *id016
193
193
  - !ruby/object:Gem::Dependency
194
- name: rake
194
+ name: charisma
195
195
  requirement: &id017 !ruby/object:Gem::Requirement
196
196
  none: false
197
197
  requirements:
@@ -202,7 +202,7 @@ dependencies:
202
202
  prerelease: false
203
203
  version_requirements: *id017
204
204
  - !ruby/object:Gem::Dependency
205
- name: rdoc
205
+ name: cucumber
206
206
  requirement: &id018 !ruby/object:Gem::Requirement
207
207
  none: false
208
208
  requirements:
@@ -213,7 +213,7 @@ dependencies:
213
213
  prerelease: false
214
214
  version_requirements: *id018
215
215
  - !ruby/object:Gem::Dependency
216
- name: rspec
216
+ name: mysql
217
217
  requirement: &id019 !ruby/object:Gem::Requirement
218
218
  none: false
219
219
  requirements:
@@ -224,7 +224,7 @@ dependencies:
224
224
  prerelease: false
225
225
  version_requirements: *id019
226
226
  - !ruby/object:Gem::Dependency
227
- name: sqlite3-ruby
227
+ name: pg
228
228
  requirement: &id020 !ruby/object:Gem::Requirement
229
229
  none: false
230
230
  requirements:
@@ -235,7 +235,7 @@ dependencies:
235
235
  prerelease: false
236
236
  version_requirements: *id020
237
237
  - !ruby/object:Gem::Dependency
238
- name: mysql
238
+ name: rake
239
239
  requirement: &id021 !ruby/object:Gem::Requirement
240
240
  none: false
241
241
  requirements:
@@ -246,7 +246,7 @@ dependencies:
246
246
  prerelease: false
247
247
  version_requirements: *id021
248
248
  - !ruby/object:Gem::Dependency
249
- name: pg
249
+ name: rdoc
250
250
  requirement: &id022 !ruby/object:Gem::Requirement
251
251
  none: false
252
252
  requirements:
@@ -256,6 +256,28 @@ dependencies:
256
256
  type: :development
257
257
  prerelease: false
258
258
  version_requirements: *id022
259
+ - !ruby/object:Gem::Dependency
260
+ name: rspec
261
+ requirement: &id023 !ruby/object:Gem::Requirement
262
+ none: false
263
+ requirements:
264
+ - - ">="
265
+ - !ruby/object:Gem::Version
266
+ version: "0"
267
+ type: :development
268
+ prerelease: false
269
+ version_requirements: *id023
270
+ - !ruby/object:Gem::Dependency
271
+ name: sqlite3-ruby
272
+ requirement: &id024 !ruby/object:Gem::Requirement
273
+ none: false
274
+ requirements:
275
+ - - ">="
276
+ - !ruby/object:Gem::Version
277
+ version: "0"
278
+ type: :development
279
+ prerelease: false
280
+ version_requirements: *id024
259
281
  description: An earth-simulation environment with ActiveRecord models and data
260
282
  email: andy@rossmeissl.net
261
283
  executables:
@@ -270,6 +292,7 @@ files:
270
292
  - .document
271
293
  - .gitignore
272
294
  - Gemfile
295
+ - Guardfile
273
296
  - LICENSE
274
297
  - LICENSE-PREAMBLE
275
298
  - README.markdown
@@ -464,8 +487,6 @@ files:
464
487
  - lib/earth/hospitality/data_miner.rb
465
488
  - lib/earth/hospitality/lodging_class.rb
466
489
  - lib/earth/hospitality/lodging_class/data_miner.rb
467
- - lib/earth/hospitality/lodging_fuel_use_equation.rb
468
- - lib/earth/hospitality/lodging_fuel_use_equation/data_miner.rb
469
490
  - lib/earth/hospitality/lodging_property.rb
470
491
  - lib/earth/industry.rb
471
492
  - lib/earth/industry/cbecs_energy_intensity.rb
@@ -581,13 +602,16 @@ files:
581
602
  - spec/earth/bus/bus_class_spec.rb
582
603
  - spec/earth/bus/bus_fuel_control_spec.rb
583
604
  - spec/earth/bus/bus_fuel_year_control_spec.rb
605
+ - spec/earth/fuel/fuel_spec.rb
606
+ - spec/earth/hospitality/lodging_fuel_use_equation_spec.rb
607
+ - spec/earth/industry/cbecs_energy_intensity_spec.rb
584
608
  - spec/earth/industry/mecs_energy_spec.rb
585
609
  - spec/earth/industry/mecs_ratio_spec.rb
586
610
  - spec/earth/locality/country_spec.rb
587
611
  - spec/earth/pet/species_spec.rb
588
612
  - spec/earth_spec.rb
589
613
  - spec/spec_helper.rb
590
- - test/test_aircraft_match.rb
614
+ - spec/support/integration.rb
591
615
  - vendor/clean_find_in_batches/init.rb
592
616
  - vendor/geokit-rails/.gitignore
593
617
  - vendor/geokit-rails/CHANGELOG.rdoc
@@ -646,7 +670,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
646
670
  requirements:
647
671
  - - ">="
648
672
  - !ruby/object:Gem::Version
649
- hash: 1670776732781702788
673
+ hash: -3928360334256672535
650
674
  segments:
651
675
  - 0
652
676
  version: "0"
@@ -655,7 +679,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
655
679
  requirements:
656
680
  - - ">="
657
681
  - !ruby/object:Gem::Version
658
- hash: 1670776732781702788
682
+ hash: -3928360334256672535
659
683
  segments:
660
684
  - 0
661
685
  version: "0"
@@ -755,10 +779,13 @@ test_files:
755
779
  - spec/earth/bus/bus_class_spec.rb
756
780
  - spec/earth/bus/bus_fuel_control_spec.rb
757
781
  - spec/earth/bus/bus_fuel_year_control_spec.rb
782
+ - spec/earth/fuel/fuel_spec.rb
783
+ - spec/earth/hospitality/lodging_fuel_use_equation_spec.rb
784
+ - spec/earth/industry/cbecs_energy_intensity_spec.rb
758
785
  - spec/earth/industry/mecs_energy_spec.rb
759
786
  - spec/earth/industry/mecs_ratio_spec.rb
760
787
  - spec/earth/locality/country_spec.rb
761
788
  - spec/earth/pet/species_spec.rb
762
789
  - spec/earth_spec.rb
763
790
  - spec/spec_helper.rb
764
- - test/test_aircraft_match.rb
791
+ - spec/support/integration.rb
@@ -1,26 +0,0 @@
1
- class LodgingFuelUseEquation < ActiveRecord::Base
2
- set_primary_key :name
3
-
4
- def self.find_by_criteria(fuel, criteria)
5
- first :conditions => {
6
- :fuel => fuel,
7
- :climate_zone_number => (criteria[:climate_zone_number].present? ? criteria[:climate_zone_number].value : nil),
8
- :property_rooms => (criteria[:property_rooms].present? ? 1 : 0),
9
- :construction_year => (criteria[:property_construction_year].present? ? 1 : 0)
10
- }
11
- end
12
-
13
- col :name
14
- col :regression
15
- col :fuel
16
- col :climate_zone_number, :type => :integer
17
- col :property_rooms, :type => :boolean
18
- col :construction_year, :type => :boolean
19
- col :rooms_factor, :type => :float
20
- col :year_factor, :type => :float
21
- col :constant, :type => :float
22
- col :units
23
- col :oil_share, :type => :float
24
- col :gas_share, :type => :float
25
- col :steam_share, :type => :float
26
- end
@@ -1,20 +0,0 @@
1
- LodgingFuelUseEquation.class_eval do
2
- data_miner do
3
- import "fuel use equations derived from CBECS 2003",
4
- :url => 'https://docs.google.com/spreadsheet/pub?key=0AoQJbWqPrREqdGN0X2l3RjFaRTBFRWdseWJoc0ZvZkE&output=csv' do
5
- key 'name'
6
- store 'regression'
7
- store 'fuel'
8
- store 'climate_zone_number', :nullify => true
9
- store 'property_rooms'
10
- store 'construction_year'
11
- store 'rooms_factor'
12
- store 'year_factor'
13
- store 'constant'
14
- store 'units'
15
- store 'oil_share'
16
- store 'gas_share'
17
- store 'steam_share'
18
- end
19
- end
20
- end
@@ -1,732 +0,0 @@
1
- class TestAircraftMatch < Test::Unit::TestCase
2
- def test_014_user_input_matches_icao_codes
3
- user_input = "Boeing 727-100RE"
4
- assert_equal ["R721"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
5
- end
6
-
7
- def test_015_user_input_matches_icao_codes
8
- user_input = "Boeing 727 200RE"
9
- assert_equal ["R722"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
10
- end
11
-
12
- def test_006_user_input_matches_icao_codes
13
- user_input = "Boeing 747400 domestic"
14
- assert_equal ["B74D"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
15
- end
16
-
17
- def test_006_user_input_matches_icao_codes
18
- user_input = "Boeing 777-200lr"
19
- assert_equal ["B77L"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
20
- end
21
-
22
- def test_006_user_input_matches_icao_codes
23
- user_input = "Boeing 707-100"
24
- assert_equal ["B701"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
25
- end
26
-
27
- def test_006_user_input_matches_icao_codes
28
- user_input = "Boeing 707-200"
29
- assert_equal ["B701", "B703"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
30
- end
31
-
32
- def test_006_user_input_matches_icao_codes
33
- user_input = "Boeing 717-200"
34
- assert_equal ["B712"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
35
- end
36
-
37
- def test_006_user_input_matches_icao_codes
38
- user_input = "Boeing 717-100"
39
- assert_equal ["B712"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
40
- end
41
-
42
- def test_006_user_input_matches_icao_codes
43
- user_input = "Boeing 727-100"
44
- assert_equal ["B721"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
45
- end
46
-
47
- def test_006_user_input_matches_icao_codes
48
- user_input = "Boeing 727-300"
49
- assert_equal ["B721", "B722"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
50
- end
51
-
52
- def test_006_user_input_matches_icao_codes
53
- user_input = "Boeing 737-900"
54
- assert_equal ["B739"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
55
- end
56
-
57
- def test_002_user_input_matches_icao_codes
58
- user_input = "Boeing 747-100"
59
- assert_equal ["B741"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
60
- end
61
-
62
- def test_002_user_input_matches_icao_codes
63
- user_input = "Boeing 747-500"
64
- assert_equal ["B741", "B742", "B743", "B744", "B74D", "B74R", "B74S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
65
- end
66
-
67
- def test_003_user_input_matches_icao_codes
68
- user_input = "Boeing 757-200"
69
- assert_equal ["B752"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
70
- end
71
-
72
- def test_003_user_input_matches_icao_codes
73
- user_input = "Boeing 757-100"
74
- assert_equal ["B752", "B753"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
75
- end
76
-
77
- def test_003_user_input_matches_icao_codes
78
- user_input = "Boeing 767-200"
79
- assert_equal ["B762"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
80
- end
81
-
82
- def test_003_user_input_matches_icao_codes
83
- user_input = "Boeing 767-100"
84
- assert_equal ["B762", "B763", "B764"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
85
- end
86
-
87
- def test_003_user_input_matches_icao_codes
88
- user_input = "Boeing 777-200"
89
- assert_equal ["B772", "B77L"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
90
- end
91
-
92
- def test_003_user_input_matches_icao_codes
93
- user_input = "Boeing 777-100"
94
- assert_equal ["B772", "B773", "B77L"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
95
- end
96
-
97
- def test_003_user_input_matches_icao_codes
98
- user_input = "Boeing 727 Stage 3"
99
- assert_equal ["B72Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
100
- end
101
-
102
- def test_003_user_input_matches_icao_codes
103
- user_input = "Boeing 737 Stage 3"
104
- assert_equal ["B73Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
105
- end
106
-
107
- def test_003_user_input_matches_icao_codes
108
- user_input = "Boeing 737 Stage 4"
109
- assert_equal ["B731", "B732", "B733", "B734", "B735", "B736", "B737", "B738", "B739", "B73Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
110
- end
111
-
112
- def test_003_user_input_matches_icao_codes
113
- user_input = "Boeing 747SP"
114
- assert_equal ["B74S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
115
- end
116
-
117
- def test_003_user_input_matches_icao_codes
118
- user_input = "Boeing 747 SR"
119
- assert_equal ["B74R"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
120
- end
121
-
122
- def test_003_user_input_matches_icao_codes
123
- user_input = "Boeing 747SCA"
124
- assert_equal ["BSCA"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
125
- end
126
-
127
- def test_003_user_input_matches_icao_codes
128
- user_input = "Boeing 747S"
129
- assert_equal ["B741", "B742", "B743", "B744", "B74D", "B74R", "B74S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
130
- end
131
-
132
- def test_003_user_input_matches_icao_codes
133
- user_input = "Boeing 720"
134
- assert_equal ["B720"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
135
- end
136
-
137
- def test_003_user_input_matches_icao_codes
138
- user_input = "Boeing 707"
139
- assert_equal ["B701", "B703"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
140
- end
141
-
142
- def test_003_user_input_matches_icao_codes
143
- user_input = "Boeing 787"
144
- assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
145
- end
146
-
147
- def test_003_user_input_matches_icao_codes
148
- user_input = "Airbus A300600"
149
- assert_equal ["A306"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
150
- end
151
-
152
- def test_003_user_input_matches_icao_codes
153
- user_input = "Airbus A300 100"
154
- assert_equal ["A306", "A30B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
155
- end
156
-
157
- def test_003_user_input_matches_icao_codes
158
- user_input = "Airbus A300-600st"
159
- assert_equal ["A3ST"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
160
- end
161
-
162
- def test_003_user_input_matches_icao_codes
163
- user_input = "Airbus Beluga"
164
- assert_equal ["A3ST"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
165
- end
166
-
167
- def test_003_user_input_matches_icao_codes
168
- user_input = "Airbus A330-200"
169
- assert_equal ["A332"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
170
- end
171
-
172
- def test_003_user_input_matches_icao_codes
173
- user_input = "Airbus A330-100"
174
- assert_equal ["A332", "A333"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
175
- end
176
-
177
- def test_003_user_input_matches_icao_codes
178
- user_input = "Airbus A340-200"
179
- assert_equal ["A342"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
180
- end
181
-
182
- def test_003_user_input_matches_icao_codes
183
- user_input = "Airbus A340-100"
184
- assert_equal ["A342", "A343", "A345", "A346"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
185
- end
186
-
187
- def test_003_user_input_matches_icao_codes
188
- user_input = "Airbus A380-800"
189
- assert_equal ["A388"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
190
- end
191
-
192
- def test_003_user_input_matches_icao_codes
193
- user_input = "Airbus A380-100"
194
- assert_equal ["A388"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
195
- end
196
-
197
- def test_003_user_input_matches_icao_codes
198
- user_input = "Airbus A300C"
199
- assert_equal ["A30B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
200
- end
201
-
202
- def test_003_user_input_matches_icao_codes
203
- user_input = "Airbus A300X"
204
- assert_equal ["A306", "A30B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
205
- end
206
-
207
- def test_003_user_input_matches_icao_codes
208
- user_input = "Airbus A318"
209
- assert_equal ["A318"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
210
- end
211
-
212
- def test_003_user_input_matches_icao_codes
213
- user_input = "Airbus A311"
214
- assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
215
- end
216
-
217
- def test_003_user_input_matches_icao_codes
218
- user_input = "Airbus A321"
219
- assert_equal ["A321"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
220
- end
221
-
222
- def test_003_user_input_matches_icao_codes
223
- user_input = "Airbus A322"
224
- assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
225
- end
226
-
227
- def test_003_user_input_matches_icao_codes
228
- user_input = "Airbus A350"
229
- assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
230
- end
231
-
232
- def test_003_user_input_matches_icao_codes
233
- user_input = "Canadair CL601"
234
- assert_equal ["CL60"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
235
- end
236
-
237
- def test_003_user_input_matches_icao_codes
238
- user_input = "Canadair CL215"
239
- assert_equal ["CL2P"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
240
- end
241
-
242
- def test_003_user_input_matches_icao_codes
243
- user_input = "Canadair CL215 turbine"
244
- assert_equal ["CL2T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
245
- end
246
-
247
- def test_003_user_input_matches_icao_codes
248
- user_input = "Canadair CL44O"
249
- assert_equal ["CL4G"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
250
- end
251
-
252
- def test_003_user_input_matches_icao_codes
253
- user_input = "Canadair CRJ440"
254
- assert_equal ["CRJ2"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
255
- end
256
-
257
- def test_003_user_input_matches_icao_codes
258
- user_input = "Canadair CRJ111"
259
- assert_equal ["CRJ1"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
260
- end
261
-
262
- def test_003_user_input_matches_icao_codes
263
- user_input = "Embraer ERJ130"
264
- assert_equal ["E135"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
265
- end
266
-
267
- def test_003_user_input_matches_icao_codes
268
- user_input = "Embraer ERJ145XR"
269
- assert_equal ["E45X"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
270
- end
271
-
272
- def test_003_user_input_matches_icao_codes
273
- user_input = "Embraer EMB110"
274
- assert_equal ["E110"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
275
- end
276
-
277
- def test_003_user_input_matches_icao_codes
278
- user_input = "Embraer Bandeirante"
279
- assert_equal ["E110"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
280
- end
281
-
282
- def test_003_user_input_matches_icao_codes
283
- user_input = "Embraer EMB120"
284
- assert_equal ["E120"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
285
- end
286
-
287
- def test_003_user_input_matches_icao_codes
288
- user_input = "Embraer Brasilia"
289
- assert_equal ["E120"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
290
- end
291
-
292
- def test_003_user_input_matches_icao_codes
293
- user_input = "Embraer EMB121"
294
- assert_equal ["E121"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
295
- end
296
-
297
- def test_003_user_input_matches_icao_codes
298
- user_input = "Embraer Xingu"
299
- assert_equal ["E121"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
300
- end
301
-
302
- def test_003_user_input_matches_icao_codes
303
- user_input = "Embraer EMB201"
304
- assert_equal ["IPAN"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
305
- end
306
-
307
- def test_003_user_input_matches_icao_codes
308
- user_input = "Embraer Ipanema"
309
- assert_equal ["IPAN"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
310
- end
311
-
312
- def test_003_user_input_matches_icao_codes
313
- user_input = "McDonnell Douglas DC3"
314
- assert_equal ["DC3", "DC3S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
315
- end
316
-
317
- def test_003_user_input_matches_icao_codes
318
- user_input = "McDonnell Douglas DC3S"
319
- assert_equal ["DC3S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
320
- end
321
-
322
- def test_003_user_input_matches_icao_codes
323
- user_input = "McDonnell Douglas DC8-50"
324
- assert_equal ["DC85"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
325
- end
326
-
327
- def test_003_user_input_matches_icao_codes
328
- user_input = "McDonnell Douglas DC8-40"
329
- assert_equal ["DC85", "DC86", "DC87", "DC8Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
330
- end
331
-
332
- def test_003_user_input_matches_icao_codes
333
- user_input = "McDonnell Douglas DC8 Stage 3"
334
- assert_equal ["DC8Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
335
- end
336
-
337
- def test_003_user_input_matches_icao_codes
338
- user_input = "McDonnell Douglas DC9-10"
339
- assert_equal ["DC91"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
340
- end
341
-
342
- def test_003_user_input_matches_icao_codes
343
- user_input = "McDonnell Douglas DC9-60"
344
- assert_equal ["DC91", "DC92", "DC93", "DC94", "DC95", "DC9Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
345
- end
346
-
347
- def test_003_user_input_matches_icao_codes
348
- user_input = "McDonnell Douglas DC9 Stage 3"
349
- assert_equal ["DC9Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
350
- end
351
-
352
- def test_003_user_input_matches_icao_codes
353
- user_input = "McDonnell Douglas DC10-10"
354
- assert_equal ["DC10"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
355
- end
356
-
357
- def test_003_user_input_matches_icao_codes
358
- user_input = "McDonnell Douglas DC4"
359
- assert_equal ["DC4"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
360
- end
361
-
362
- def test_003_user_input_matches_icao_codes
363
- user_input = "McDonnell Douglas DC5"
364
- assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
365
- end
366
-
367
- def test_003_user_input_matches_icao_codes
368
- user_input = "McDonnell Douglas MD81"
369
- assert_equal ["MD81"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
370
- end
371
-
372
- def test_003_user_input_matches_icao_codes
373
- user_input = "McDonnell Douglas MD84"
374
- assert_equal ["MD81", "MD82", "MD83", "MD87", "MD88"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
375
- end
376
-
377
- def test_003_user_input_matches_icao_codes
378
- user_input = "McDonnell Douglas MD11"
379
- assert_equal ["MD11"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
380
- end
381
-
382
- def test_003_user_input_matches_icao_codes
383
- user_input = "McDonnell Douglas MD90"
384
- assert_equal ["MD90"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
385
- end
386
-
387
- def test_003_user_input_matches_icao_codes
388
- user_input = "McDonnell Douglas C133"
389
- assert_equal ["C133"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
390
- end
391
-
392
- def test_003_user_input_matches_icao_codes
393
- user_input = "McDonnell Douglas Cargomaster"
394
- assert_equal ["C133"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
395
- end
396
-
397
- def test_003_user_input_matches_icao_codes
398
- user_input = "de Havilland DHC8-100"
399
- assert_equal ["DH8A"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
400
- end
401
-
402
- def test_003_user_input_matches_icao_codes
403
- user_input = "de Havilland DHC8-500"
404
- assert_equal ["DH8A", "DH8B", "DH8C", "DH8D"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
405
- end
406
-
407
- def test_003_user_input_matches_icao_codes
408
- user_input = "de Havilland DHC1"
409
- assert_equal ["DHC1"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
410
- end
411
-
412
- def test_003_user_input_matches_icao_codes
413
- user_input = "de Havilland Chipmunk"
414
- assert_equal ["DHC1"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
415
- end
416
-
417
- def test_003_user_input_matches_icao_codes
418
- user_input = "de Havilland DHC2 mk1"
419
- assert_equal ["DHC2"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
420
- end
421
-
422
- def test_003_user_input_matches_icao_codes
423
- user_input = "de Havilland DHC2 mk3"
424
- assert_equal ["DH2T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
425
- end
426
-
427
- def test_003_user_input_matches_icao_codes
428
- user_input = "de Havilland Beaver"
429
- assert_equal ["DHC2"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
430
- end
431
-
432
- def test_003_user_input_matches_icao_codes
433
- user_input = "de Havilland Turbo Beaver"
434
- assert_equal ["DH2T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
435
- end
436
-
437
- def test_003_user_input_matches_icao_codes
438
- user_input = "de Havilland DHC2"
439
- assert_equal ["DHC2", "DH2T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
440
- end
441
-
442
- def test_003_user_input_matches_icao_codes
443
- user_input = "de Havilland DHC3"
444
- assert_equal ["DHC3", "DH3T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
445
- end
446
-
447
- def test_003_user_input_matches_icao_codes
448
- user_input = "de Havilland Otter"
449
- assert_equal ["DHC3"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
450
- end
451
-
452
- def test_003_user_input_matches_icao_codes
453
- user_input = "de Havilland Turbo Otter"
454
- assert_equal ["DH3T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
455
- end
456
-
457
- def test_003_user_input_matches_icao_codes
458
- user_input = "de Havilland DHC4"
459
- assert_equal ["DHC4"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
460
- end
461
-
462
- def test_003_user_input_matches_icao_codes
463
- user_input = "de Havilland Caribou"
464
- assert_equal ["DHC4"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
465
- end
466
-
467
- def test_003_user_input_matches_icao_codes
468
- user_input = "de Havilland DHC5"
469
- assert_equal ["DHC5"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
470
- end
471
-
472
- def test_003_user_input_matches_icao_codes
473
- user_input = "de Havilland Buffalo"
474
- assert_equal ["DHC5"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
475
- end
476
-
477
- def test_003_user_input_matches_icao_codes
478
- user_input = "de Havilland DHC6"
479
- assert_equal ["DHC6"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
480
- end
481
-
482
- def test_003_user_input_matches_icao_codes
483
- user_input = "de Havilland Twin"
484
- assert_equal ["DHC6"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
485
- end
486
-
487
- def test_003_user_input_matches_icao_codes
488
- user_input = "de Havilland DHC7"
489
- assert_equal ["DHC7"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
490
- end
491
-
492
- def test_003_user_input_matches_icao_codes
493
- user_input = "de Havilland Dash 7"
494
- assert_equal ["DHC7"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
495
- end
496
-
497
- def test_003_user_input_matches_icao_codes
498
- user_input = "aerospatiale atr42"
499
- assert_equal ["AT43", "AT44", "AT45"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
500
- end
501
-
502
- def test_003_user_input_matches_icao_codes
503
- user_input = "aerospatiale atr72"
504
- assert_equal ["AT72"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
505
- end
506
-
507
- def test_003_user_input_matches_icao_codes
508
- user_input = "bae bae 146 100"
509
- assert_equal ["B461"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
510
- end
511
-
512
- def test_003_user_input_matches_icao_codes
513
- user_input = "bae bae146-400"
514
- assert_equal ["B461", "B462", "B463"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
515
- end
516
-
517
- def test_003_user_input_matches_icao_codes
518
- user_input = "bae jetstream 32"
519
- assert_equal ["JS32"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
520
- end
521
-
522
- def test_003_user_input_matches_icao_codes
523
- user_input = "bae jetstream super 31"
524
- assert_equal ["JS32"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
525
- end
526
-
527
- def test_003_user_input_matches_icao_codes
528
- user_input = "bae jetstream 31"
529
- assert_equal ["JS31"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
530
- end
531
-
532
- def test_003_user_input_matches_icao_codes
533
- user_input = "bae jetstream 41"
534
- assert_equal ["JS41"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
535
- end
536
-
537
- def test_003_user_input_matches_icao_codes
538
- user_input = "bae atp"
539
- assert_equal ["atp"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
540
- end
541
-
542
- def test_003_user_input_matches_icao_codes
543
- user_input = "bae bac one-eleven"
544
- assert_equal ["BA11"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
545
- end
546
-
547
- def test_003_user_input_matches_icao_codes
548
- user_input = "bae bac111"
549
- assert_equal ["BA11"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
550
- end
551
-
552
- def test_003_user_input_matches_icao_codes
553
- user_input = "bae bae125-1000"
554
- assert_equal ["H25C"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
555
- end
556
-
557
- def test_003_user_input_matches_icao_codes
558
- user_input = "bae bae125-70"
559
- assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
560
- end
561
-
562
- def test_003_user_input_matches_icao_codes
563
- user_input = "bae bae125-75"
564
- assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
565
- end
566
-
567
- def test_003_user_input_matches_icao_codes
568
- user_input = "bae bae125-80"
569
- assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
570
- end
571
-
572
- def test_003_user_input_matches_icao_codes
573
- user_input = "bae bae125-85"
574
- assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
575
- end
576
-
577
- def test_003_user_input_matches_icao_codes
578
- user_input = "bae bae125-90"
579
- assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
580
- end
581
-
582
- def test_003_user_input_matches_icao_codes
583
- user_input = "bae bae125-95"
584
- assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
585
- end
586
-
587
- def test_003_user_input_matches_icao_codes
588
- user_input = "bae bae125"
589
- assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
590
- end
591
-
592
- def test_003_user_input_matches_icao_codes
593
- user_input = "fokker 50"
594
- assert_equal ["F50"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
595
- end
596
-
597
- def test_003_user_input_matches_icao_codes
598
- user_input = "fokker 61"
599
- assert_equal ["F60"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
600
- end
601
-
602
- def test_003_user_input_matches_icao_codes
603
- user_input = "fokker 72"
604
- assert_equal ["F70"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
605
- end
606
-
607
- def test_003_user_input_matches_icao_codes
608
- user_input = "fokker 103"
609
- assert_equal ["F100"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
610
- end
611
-
612
- def test_003_user_input_matches_icao_codes
613
- user_input = "fokker 80"
614
- assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
615
- end
616
-
617
- def test_003_user_input_matches_icao_codes
618
- user_input = "fokker F27"
619
- assert_equal ["F27"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
620
- end
621
-
622
- def test_003_user_input_matches_icao_codes
623
- user_input = "fokker Friendship"
624
- assert_equal ["F27"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
625
- end
626
-
627
- def test_003_user_input_matches_icao_codes
628
- user_input = "fokker F28"
629
- assert_equal ["F28"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
630
- end
631
-
632
- def test_003_user_input_matches_icao_codes
633
- user_input = "fokker Fellowship"
634
- assert_equal ["F28"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
635
- end
636
-
637
- def test_003_user_input_matches_icao_codes
638
- user_input = "fokker super"
639
- assert_equal ["SUNV"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
640
- end
641
-
642
- def test_003_user_input_matches_icao_codes
643
- user_input = "saab 2000"
644
- assert_equal ["SB20"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
645
- end
646
-
647
- def test_003_user_input_matches_icao_codes
648
- user_input = "saab 340"
649
- assert_equal ["SF34"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
650
- end
651
-
652
- def test_003_user_input_matches_icao_codes
653
- user_input = "saab 91"
654
- assert_equal ["SB91"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
655
- end
656
-
657
- def test_003_user_input_matches_icao_codes
658
- user_input = "saab safir"
659
- assert_equal ["SB91"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
660
- end
661
-
662
- def test_003_user_input_matches_icao_codes
663
- user_input = "hawker beechcraft 1900"
664
- assert_equal ["B190"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
665
- end
666
-
667
- def test_003_user_input_matches_icao_codes
668
- user_input = "cessna 401"
669
- assert_equal ["C402"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
670
- end
671
-
672
- def test_003_user_input_matches_icao_codes
673
- user_input = "cessna 402"
674
- assert_equal ["C402"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
675
- end
676
-
677
- def test_003_user_input_matches_icao_codes
678
- user_input = "cessna 208"
679
- assert_equal ["C208"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
680
- end
681
-
682
- def test_003_user_input_matches_icao_codes
683
- user_input = "cessna caravan"
684
- assert_equal ["C208"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
685
- end
686
-
687
- def test_003_user_input_matches_icao_codes
688
- user_input = "cessna cargomaster"
689
- assert_equal ["C208"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
690
- end
691
-
692
- def test_003_user_input_matches_icao_codes
693
- user_input = "cessna grand caravan"
694
- assert_equal ["C208"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
695
- end
696
-
697
-
698
-
699
- # def test_001_flight_segments_match_icao_codes
700
- # flight_segment_bts_aircraft_type_description = 'BOEING 747-100' # aka type 816
701
- # assert_equal %w{ B741 B742 B743 B744 B74D B74R B74S }, Aircraft.fuzzy_match(flight_segment_bts_aircraft_type_description).map(&:icao_code)
702
- # end
703
- #
704
- # def test_003_user_input_matches_flight_segments
705
- # user_input = '747'
706
- # aircraft_suggested_by_user_input = Aircraft.fuzzy_match(user_input)
707
- #
708
- # # this is why the following query should work...
709
- # # FlightSegment.cohort(:aircraft => [ B731, B732 ])
710
- # # FlightSegment => FuzzyAircraftMatch <= Aircraft
711
- # # select * from flight_segments
712
- # # inner join
713
- # # fuzzy_aircraft_matches on
714
- # # flight_segments.aircraft_description = fuzzy_aircraft_matches.bbb # FlightSegment.has_many :aircraft [...] :foreign_key => :bbb
715
- # # where
716
- # # fuzzy_aircraft_matches.aaa in ('B731', 'B732') # Aircraft.has_many :aircraft [...] :foreign_key => :aaa
717
- #
718
- # assert_equal [...flight segments...], FlightSegment.cohort(:aircraft => aircraft_suggested_by_user_input)
719
- # end
720
- #
721
- # def test_004_user_input_matches_fuel_use_equations
722
- # user_input = '747'
723
- # aircraft_suggested_by_user_input = Aircraft.fuzzy_match(user_input)
724
- #
725
- # # see above for why this would work
726
- # # ...
727
- # # fuel_use_equations.aircraft_description = fuzzy_aircraft_matches.bbb # FuelUseEquation.has_many :aircraft [...] :foreign_key => :bbb
728
- # # ...
729
- #
730
- # assert_equal [...flight segments...], FuelUseEquation.cohort(:aircraft => aircraft_suggested_by_user_input)
731
- # end
732
- end