earth 0.11.7 → 0.11.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +30 -0
- data/bin/earth_tester.rb +1 -1
- data/earth.gemspec +3 -3
- data/lib/earth.rb +105 -90
- data/lib/earth/air.rb +3 -12
- data/lib/earth/air/aircraft.rb +9 -9
- data/lib/earth/air/airport.rb +3 -0
- data/lib/earth/air/airport/data_miner.rb +2 -0
- data/lib/earth/air/data_miner.rb +3 -10
- data/lib/earth/air/flight_segment.rb +3 -1
- data/lib/earth/air/flight_segment/data_miner.rb +2 -0
- data/lib/earth/all.rb +3 -13
- data/lib/earth/automobile.rb +3 -18
- data/lib/earth/automobile/automobile_fuel.rb +1 -3
- data/lib/earth/automobile/automobile_fuel/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_make.rb +1 -0
- data/lib/earth/automobile/automobile_make/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_make_model.rb +1 -0
- data/lib/earth/automobile/automobile_make_model/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_make_model_year.rb +1 -0
- data/lib/earth/automobile/automobile_make_model_year/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_make_model_year_variant.rb +1 -0
- data/lib/earth/automobile/automobile_make_model_year_variant/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_make_year.rb +1 -0
- data/lib/earth/automobile/automobile_make_year/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_make_year_fleet.rb +1 -0
- data/lib/earth/automobile/automobile_make_year_fleet/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_model.rb +1 -0
- data/lib/earth/automobile/automobile_model/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_size_class.rb +1 -0
- data/lib/earth/automobile/automobile_size_class/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_size_class_year.rb +1 -0
- data/lib/earth/automobile/automobile_size_class_year/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_type_fuel_control.rb +1 -0
- data/lib/earth/automobile/automobile_type_fuel_control/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_type_fuel_year.rb +1 -0
- data/lib/earth/automobile/automobile_type_fuel_year/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_type_fuel_year_age.rb +1 -0
- data/lib/earth/automobile/automobile_type_fuel_year_age/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_type_fuel_year_control.rb +1 -0
- data/lib/earth/automobile/automobile_type_fuel_year_control/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_type_year.rb +1 -0
- data/lib/earth/automobile/automobile_type_year/data_miner.rb +1 -0
- data/lib/earth/automobile/automobile_year.rb +1 -0
- data/lib/earth/automobile/automobile_year/data_miner.rb +1 -0
- data/lib/earth/automobile/data_miner.rb +3 -18
- data/lib/earth/bus.rb +3 -6
- data/lib/earth/bus/bus_class.rb +1 -0
- data/lib/earth/bus/bus_class/data_miner.rb +1 -0
- data/lib/earth/bus/bus_fuel.rb +1 -0
- data/lib/earth/bus/bus_fuel/data_miner.rb +1 -0
- data/lib/earth/bus/bus_fuel_control.rb +1 -0
- data/lib/earth/bus/bus_fuel_control/data_miner.rb +1 -0
- data/lib/earth/bus/bus_fuel_year_control.rb +1 -0
- data/lib/earth/bus/bus_fuel_year_control/data_miner.rb +1 -0
- data/lib/earth/bus/data_miner.rb +3 -6
- data/lib/earth/computation.rb +3 -5
- data/lib/earth/computation/computation_carrier.rb +1 -0
- data/lib/earth/computation/computation_carrier/data_miner.rb +1 -1
- data/lib/earth/computation/computation_carrier_instance_class.rb +1 -0
- data/lib/earth/computation/computation_carrier_instance_class/data_miner.rb +1 -0
- data/lib/earth/computation/computation_carrier_region.rb +1 -0
- data/lib/earth/computation/computation_carrier_region/data_miner.rb +1 -0
- data/lib/earth/computation/data_miner.rb +3 -5
- data/lib/earth/data_miner.rb +3 -13
- data/lib/earth/diet.rb +3 -2
- data/lib/earth/diet/data_miner.rb +3 -2
- data/lib/earth/eia.rb +11 -13
- data/lib/earth/fuel.rb +3 -5
- data/lib/earth/fuel/data_miner.rb +3 -5
- data/lib/earth/fuel/fuel_price.rb +1 -1
- data/lib/earth/hospitality.rb +3 -5
- data/lib/earth/hospitality/commercial_building_energy_consumption_survey_response.rb +2 -0
- data/lib/earth/hospitality/commercial_building_energy_consumption_survey_response/data_miner.rb +13 -7
- data/lib/earth/hospitality/country_lodging_class.rb +1 -0
- data/lib/earth/hospitality/country_lodging_class/data_miner.rb +4 -2
- data/lib/earth/hospitality/data_miner.rb +3 -4
- data/lib/earth/hospitality/lodging_class.rb +1 -10
- data/lib/earth/hospitality/lodging_class/data_miner.rb +7 -30
- data/lib/earth/hospitality/lodging_property.rb +1 -0
- data/lib/earth/industry.rb +3 -13
- data/lib/earth/industry/cbecs_energy_intensity.rb +5 -49
- data/lib/earth/industry/cbecs_energy_intensity/data_miner.rb +94 -42
- data/lib/earth/industry/data_miner.rb +3 -4
- data/lib/earth/industry/industry.rb +1 -0
- data/lib/earth/industry/industry/data_miner.rb +1 -0
- data/lib/earth/industry/industry_product.rb +1 -0
- data/lib/earth/industry/industry_product_line.rb +1 -0
- data/lib/earth/industry/industry_sector.rb +1 -0
- data/lib/earth/industry/mecs_energy.rb +3 -24
- data/lib/earth/industry/mecs_energy/data_miner.rb +34 -11
- data/lib/earth/industry/mecs_ratio.rb +6 -24
- data/lib/earth/industry/mecs_ratio/data_miner.rb +24 -1
- data/lib/earth/locality.rb +3 -15
- data/lib/earth/locality/census_division.rb +1 -0
- data/lib/earth/locality/census_division/data_miner.rb +1 -0
- data/lib/earth/locality/country.rb +3 -0
- data/lib/earth/locality/country/data_miner.rb +5 -1
- data/lib/earth/locality/data_miner.rb +3 -15
- data/lib/earth/locality/egrid_subregion.rb +1 -0
- data/lib/earth/locality/egrid_subregion/data_miner.rb +1 -0
- data/lib/earth/locality/state/data_miner.rb +11 -11
- data/lib/earth/locality/zip_code.rb +6 -0
- data/lib/earth/pet.rb +3 -4
- data/lib/earth/pet/data_miner.rb +3 -4
- data/lib/earth/rail.rb +3 -15
- data/lib/earth/rail/country_rail_class.rb +1 -0
- data/lib/earth/rail/country_rail_class/data_miner.rb +1 -0
- data/lib/earth/rail/country_rail_traction.rb +2 -0
- data/lib/earth/rail/country_rail_traction/data_miner.rb +2 -0
- data/lib/earth/rail/country_rail_traction_class.rb +2 -0
- data/lib/earth/rail/country_rail_traction_class/data_miner.rb +2 -0
- data/lib/earth/rail/data_miner.rb +3 -16
- data/lib/earth/rail/national_transit_database_company.rb +1 -0
- data/lib/earth/rail/national_transit_database_company/data_miner.rb +1 -0
- data/lib/earth/rail/national_transit_database_record.rb +1 -0
- data/lib/earth/rail/national_transit_database_record/data_miner.rb +1 -0
- data/lib/earth/rail/rail_company.rb +2 -0
- data/lib/earth/rail/rail_company/data_miner.rb +2 -0
- data/lib/earth/rail/rail_company_traction.rb +1 -0
- data/lib/earth/rail/rail_company_traction/data_miner.rb +1 -0
- data/lib/earth/rail/rail_company_traction_class.rb +1 -0
- data/lib/earth/rail/rail_company_traction_class/data_miner.rb +1 -0
- data/lib/earth/rail/rail_fuel.rb +1 -0
- data/lib/earth/rail/rail_fuel/data_miner.rb +1 -0
- data/lib/earth/residence.rb +3 -11
- data/lib/earth/residence/data_miner.rb +3 -11
- data/lib/earth/residence/residence_fuel_price.rb +1 -0
- data/lib/earth/residence/residence_fuel_price/data_miner.rb +1 -0
- data/lib/earth/residence/residential_energy_consumption_survey_response.rb +1 -0
- data/lib/earth/residence/residential_energy_consumption_survey_response/data_miner.rb +1 -0
- data/lib/earth/shipping.rb +3 -3
- data/lib/earth/shipping/data_miner.rb +3 -3
- data/lib/earth/version.rb +1 -1
- data/spec/earth/industry/mecs_energy_spec.rb +18 -0
- data/spec/earth_spec.rb +18 -29
- data/test/test_aircraft_match.rb +142 -142
- data/vendor/geokit-rails/.gitignore +2 -0
- data/vendor/geokit-rails/CHANGELOG.rdoc +4 -1
- data/vendor/geokit-rails/README.markdown +11 -3
- data/vendor/geokit-rails/about.yml +2 -0
- data/vendor/geokit-rails/lib/geokit-rails.rb +7 -4
- data/vendor/geokit-rails/lib/geokit-rails/acts_as_mappable.rb +15 -2
- data/vendor/geokit-rails/lib/geokit-rails/adapters/abstract.rb +1 -1
- data/vendor/geokit-rails/lib/geokit-rails/adapters/mysql2.rb +22 -0
- data/vendor/geokit-rails/test/database.yml +5 -0
- data/vendor/geokit-rails/test/ip_geocode_lookup_test.rb +1 -1
- data/vendor/geokit-rails/test/tasks.rake +2 -2
- metadata +179 -191
- data/lib/earth/hospitality/census_region_lodging_class.rb +0 -16
- data/lib/earth/hospitality/census_region_lodging_class/data_miner.rb +0 -40
data/lib/earth/rail/rail_fuel.rb
CHANGED
data/lib/earth/residence.rb
CHANGED
@@ -1,11 +1,3 @@
|
|
1
|
-
|
2
|
-
require 'earth
|
3
|
-
|
4
|
-
require 'earth/residence/clothes_machine_use'
|
5
|
-
require 'earth/residence/dishwasher_use'
|
6
|
-
require 'earth/residence/residence_appliance'
|
7
|
-
require 'earth/residence/residence_class'
|
8
|
-
require 'earth/residence/residence_fuel_price'
|
9
|
-
require 'earth/residence/residence_fuel_type'
|
10
|
-
require 'earth/residence/residential_energy_consumption_survey_response'
|
11
|
-
require 'earth/residence/urbanity'
|
1
|
+
# lib/earth/residence.rb
|
2
|
+
require 'earth'
|
3
|
+
Earth.require_related __FILE__
|
@@ -1,11 +1,3 @@
|
|
1
|
-
|
2
|
-
require 'earth
|
3
|
-
|
4
|
-
require 'earth/residence/clothes_machine_use/data_miner'
|
5
|
-
require 'earth/residence/dishwasher_use/data_miner'
|
6
|
-
require 'earth/residence/residence_appliance/data_miner'
|
7
|
-
require 'earth/residence/residence_class/data_miner'
|
8
|
-
require 'earth/residence/residence_fuel_price/data_miner'
|
9
|
-
require 'earth/residence/residence_fuel_type/data_miner'
|
10
|
-
require 'earth/residence/residential_energy_consumption_survey_response/data_miner'
|
11
|
-
require 'earth/residence/urbanity/data_miner'
|
1
|
+
# lib/earth/residence/data_miner.rb
|
2
|
+
require 'earth'
|
3
|
+
Earth.require_related __FILE__
|
data/lib/earth/shipping.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
require 'earth
|
3
|
-
|
1
|
+
# lib/earth/shipping.rb
|
2
|
+
require 'earth'
|
3
|
+
Earth.require_related __FILE__
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
require 'earth
|
3
|
-
|
1
|
+
# lib/earth/shipping/data_miner.rb
|
2
|
+
require 'earth'
|
3
|
+
Earth.require_related __FILE__
|
data/lib/earth/version.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'earth/industry'
|
2
3
|
require 'earth/industry/mecs_energy'
|
4
|
+
require 'earth/industry/mecs_energy/data_miner'
|
3
5
|
|
4
6
|
describe MecsEnergy do
|
5
7
|
before(:all) do
|
@@ -7,6 +9,22 @@ describe MecsEnergy do
|
|
7
9
|
MecsEnergy.run_data_miner!
|
8
10
|
end
|
9
11
|
|
12
|
+
describe 'data mining' do
|
13
|
+
it 'retrieves Total US statistics' do
|
14
|
+
apparel = MecsEnergy.find_by_naics_code '315'
|
15
|
+
apparel.census_region.should be_nil
|
16
|
+
apparel.total.should == 14
|
17
|
+
apparel.net_electricity.should == 7
|
18
|
+
apparel.residual_fuel_oil.should be_nil
|
19
|
+
apparel.distillate_fuel_oil.should == 0
|
20
|
+
apparel.natural_gas.should == 7
|
21
|
+
apparel.lpg_and_ngl.should == 0
|
22
|
+
apparel.coal.should == 0
|
23
|
+
apparel.coke_and_breeze.should == 0
|
24
|
+
apparel.other.should == 0
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
10
28
|
describe '.find_by_naics_code_and_census_region' do
|
11
29
|
before do
|
12
30
|
MecsEnergy.create! :naics_code => '312', :census_region => '1'
|
data/spec/earth_spec.rb
CHANGED
@@ -20,38 +20,27 @@ describe Earth do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
describe '.
|
24
|
-
it 'should get a list of resource_map' do
|
25
|
-
resource_map = Earth.resource_map
|
26
|
-
resource_map.keys.count.should == 96
|
27
|
-
resource_map['FuelType'].should == 'fuel'
|
28
|
-
end
|
29
|
-
it 'should exclude data_miner files' do
|
30
|
-
Earth.resource_map.keys.should_not include('DataMiner')
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '.search' do
|
23
|
+
describe '.resources' do
|
35
24
|
it 'should get a list of all resource names' do
|
36
|
-
Earth.
|
37
|
-
Earth.
|
38
|
-
Earth.
|
25
|
+
Earth.resources.length.should == 95
|
26
|
+
Earth.resources.should include('Aircraft')
|
27
|
+
Earth.resources.should include('Industry')
|
39
28
|
end
|
40
29
|
it 'should filter resource_map by domain' do
|
41
|
-
Earth.
|
42
|
-
Earth.
|
43
|
-
Earth.
|
44
|
-
Earth.
|
45
|
-
Earth.
|
46
|
-
Earth.
|
47
|
-
Earth.
|
48
|
-
Earth.
|
49
|
-
Earth.
|
50
|
-
Earth.
|
51
|
-
Earth.
|
52
|
-
Earth.
|
53
|
-
Earth.
|
54
|
-
Earth.
|
30
|
+
Earth.resources('air').length.should == 10
|
31
|
+
Earth.resources('automobile').length.should == 16
|
32
|
+
Earth.resources('bus').length.should == 4
|
33
|
+
Earth.resources('computation').length.should == 3
|
34
|
+
Earth.resources('diet').length.should == 2
|
35
|
+
Earth.resources('fuel').length.should == 5
|
36
|
+
Earth.resources('hospitality').length.should == 4
|
37
|
+
Earth.resources('industry').length.should == 13
|
38
|
+
Earth.resources('locality').length.should == 10
|
39
|
+
Earth.resources('pet').length.should == 4
|
40
|
+
Earth.resources('rail').length.should == 12
|
41
|
+
Earth.resources('residence').length.should == 9
|
42
|
+
Earth.resources('shipping').length.should == 3
|
43
|
+
Earth.resources('fuel').should include('FuelType')
|
55
44
|
end
|
56
45
|
end
|
57
46
|
|
data/test/test_aircraft_match.rb
CHANGED
@@ -1,709 +1,709 @@
|
|
1
1
|
class TestAircraftMatch < Test::Unit::TestCase
|
2
2
|
def test_014_user_input_matches_icao_codes
|
3
3
|
user_input = "Boeing 727-100RE"
|
4
|
-
assert_equal ["R721"], Aircraft.
|
4
|
+
assert_equal ["R721"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
5
5
|
end
|
6
6
|
|
7
7
|
def test_015_user_input_matches_icao_codes
|
8
8
|
user_input = "Boeing 727 200RE"
|
9
|
-
assert_equal ["R722"], Aircraft.
|
9
|
+
assert_equal ["R722"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_006_user_input_matches_icao_codes
|
13
13
|
user_input = "Boeing 747400 domestic"
|
14
|
-
assert_equal ["B74D"], Aircraft.
|
14
|
+
assert_equal ["B74D"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_006_user_input_matches_icao_codes
|
18
18
|
user_input = "Boeing 777-200lr"
|
19
|
-
assert_equal ["B77L"], Aircraft.
|
19
|
+
assert_equal ["B77L"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_006_user_input_matches_icao_codes
|
23
23
|
user_input = "Boeing 707-100"
|
24
|
-
assert_equal ["B701"], Aircraft.
|
24
|
+
assert_equal ["B701"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_006_user_input_matches_icao_codes
|
28
28
|
user_input = "Boeing 707-200"
|
29
|
-
assert_equal ["B701", "B703"], Aircraft.
|
29
|
+
assert_equal ["B701", "B703"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_006_user_input_matches_icao_codes
|
33
33
|
user_input = "Boeing 717-200"
|
34
|
-
assert_equal ["B712"], Aircraft.
|
34
|
+
assert_equal ["B712"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_006_user_input_matches_icao_codes
|
38
38
|
user_input = "Boeing 717-100"
|
39
|
-
assert_equal ["B712"], Aircraft.
|
39
|
+
assert_equal ["B712"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_006_user_input_matches_icao_codes
|
43
43
|
user_input = "Boeing 727-100"
|
44
|
-
assert_equal ["B721"], Aircraft.
|
44
|
+
assert_equal ["B721"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
45
45
|
end
|
46
46
|
|
47
47
|
def test_006_user_input_matches_icao_codes
|
48
48
|
user_input = "Boeing 727-300"
|
49
|
-
assert_equal ["B721", "B722"], Aircraft.
|
49
|
+
assert_equal ["B721", "B722"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
50
50
|
end
|
51
51
|
|
52
52
|
def test_006_user_input_matches_icao_codes
|
53
53
|
user_input = "Boeing 737-900"
|
54
|
-
assert_equal ["B739"], Aircraft.
|
54
|
+
assert_equal ["B739"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
55
55
|
end
|
56
56
|
|
57
57
|
def test_002_user_input_matches_icao_codes
|
58
58
|
user_input = "Boeing 747-100"
|
59
|
-
assert_equal ["B741"], Aircraft.
|
59
|
+
assert_equal ["B741"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
60
60
|
end
|
61
61
|
|
62
62
|
def test_002_user_input_matches_icao_codes
|
63
63
|
user_input = "Boeing 747-500"
|
64
|
-
assert_equal ["B741", "B742", "B743", "B744", "B74D", "B74R", "B74S"], Aircraft.
|
64
|
+
assert_equal ["B741", "B742", "B743", "B744", "B74D", "B74R", "B74S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
65
65
|
end
|
66
66
|
|
67
67
|
def test_003_user_input_matches_icao_codes
|
68
68
|
user_input = "Boeing 757-200"
|
69
|
-
assert_equal ["B752"], Aircraft.
|
69
|
+
assert_equal ["B752"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
70
70
|
end
|
71
71
|
|
72
72
|
def test_003_user_input_matches_icao_codes
|
73
73
|
user_input = "Boeing 757-100"
|
74
|
-
assert_equal ["B752", "B753"], Aircraft.
|
74
|
+
assert_equal ["B752", "B753"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
75
75
|
end
|
76
76
|
|
77
77
|
def test_003_user_input_matches_icao_codes
|
78
78
|
user_input = "Boeing 767-200"
|
79
|
-
assert_equal ["B762"], Aircraft.
|
79
|
+
assert_equal ["B762"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
80
80
|
end
|
81
81
|
|
82
82
|
def test_003_user_input_matches_icao_codes
|
83
83
|
user_input = "Boeing 767-100"
|
84
|
-
assert_equal ["B762", "B763", "B764"], Aircraft.
|
84
|
+
assert_equal ["B762", "B763", "B764"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
85
85
|
end
|
86
86
|
|
87
87
|
def test_003_user_input_matches_icao_codes
|
88
88
|
user_input = "Boeing 777-200"
|
89
|
-
assert_equal ["B772", "B77L"], Aircraft.
|
89
|
+
assert_equal ["B772", "B77L"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
90
90
|
end
|
91
91
|
|
92
92
|
def test_003_user_input_matches_icao_codes
|
93
93
|
user_input = "Boeing 777-100"
|
94
|
-
assert_equal ["B772", "B773", "B77L"], Aircraft.
|
94
|
+
assert_equal ["B772", "B773", "B77L"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
95
95
|
end
|
96
96
|
|
97
97
|
def test_003_user_input_matches_icao_codes
|
98
98
|
user_input = "Boeing 727 Stage 3"
|
99
|
-
assert_equal ["B72Q"], Aircraft.
|
99
|
+
assert_equal ["B72Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
100
100
|
end
|
101
101
|
|
102
102
|
def test_003_user_input_matches_icao_codes
|
103
103
|
user_input = "Boeing 737 Stage 3"
|
104
|
-
assert_equal ["B73Q"], Aircraft.
|
104
|
+
assert_equal ["B73Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
105
105
|
end
|
106
106
|
|
107
107
|
def test_003_user_input_matches_icao_codes
|
108
108
|
user_input = "Boeing 737 Stage 4"
|
109
|
-
assert_equal ["B731", "B732", "B733", "B734", "B735", "B736", "B737", "B738", "B739", "B73Q"], Aircraft.
|
109
|
+
assert_equal ["B731", "B732", "B733", "B734", "B735", "B736", "B737", "B738", "B739", "B73Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
110
110
|
end
|
111
111
|
|
112
112
|
def test_003_user_input_matches_icao_codes
|
113
113
|
user_input = "Boeing 747SP"
|
114
|
-
assert_equal ["B74S"], Aircraft.
|
114
|
+
assert_equal ["B74S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
115
115
|
end
|
116
116
|
|
117
117
|
def test_003_user_input_matches_icao_codes
|
118
118
|
user_input = "Boeing 747 SR"
|
119
|
-
assert_equal ["B74R"], Aircraft.
|
119
|
+
assert_equal ["B74R"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
120
120
|
end
|
121
121
|
|
122
122
|
def test_003_user_input_matches_icao_codes
|
123
123
|
user_input = "Boeing 747SCA"
|
124
|
-
assert_equal ["BSCA"], Aircraft.
|
124
|
+
assert_equal ["BSCA"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
125
125
|
end
|
126
126
|
|
127
127
|
def test_003_user_input_matches_icao_codes
|
128
128
|
user_input = "Boeing 747S"
|
129
|
-
assert_equal ["B741", "B742", "B743", "B744", "B74D", "B74R", "B74S"], Aircraft.
|
129
|
+
assert_equal ["B741", "B742", "B743", "B744", "B74D", "B74R", "B74S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
130
130
|
end
|
131
131
|
|
132
132
|
def test_003_user_input_matches_icao_codes
|
133
133
|
user_input = "Boeing 720"
|
134
|
-
assert_equal ["B720"], Aircraft.
|
134
|
+
assert_equal ["B720"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
135
135
|
end
|
136
136
|
|
137
137
|
def test_003_user_input_matches_icao_codes
|
138
138
|
user_input = "Boeing 707"
|
139
|
-
assert_equal ["B701", "B703"], Aircraft.
|
139
|
+
assert_equal ["B701", "B703"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
140
140
|
end
|
141
141
|
|
142
142
|
def test_003_user_input_matches_icao_codes
|
143
143
|
user_input = "Boeing 787"
|
144
|
-
assert_equal [], Aircraft.
|
144
|
+
assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
145
145
|
end
|
146
146
|
|
147
147
|
def test_003_user_input_matches_icao_codes
|
148
148
|
user_input = "Airbus A300600"
|
149
|
-
assert_equal ["A306"], Aircraft.
|
149
|
+
assert_equal ["A306"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
150
150
|
end
|
151
151
|
|
152
152
|
def test_003_user_input_matches_icao_codes
|
153
153
|
user_input = "Airbus A300 100"
|
154
|
-
assert_equal ["A306", "A30B"], Aircraft.
|
154
|
+
assert_equal ["A306", "A30B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
155
155
|
end
|
156
156
|
|
157
157
|
def test_003_user_input_matches_icao_codes
|
158
158
|
user_input = "Airbus A300-600st"
|
159
|
-
assert_equal ["A3ST"], Aircraft.
|
159
|
+
assert_equal ["A3ST"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
160
160
|
end
|
161
161
|
|
162
162
|
def test_003_user_input_matches_icao_codes
|
163
163
|
user_input = "Airbus Beluga"
|
164
|
-
assert_equal ["A3ST"], Aircraft.
|
164
|
+
assert_equal ["A3ST"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
165
165
|
end
|
166
166
|
|
167
167
|
def test_003_user_input_matches_icao_codes
|
168
168
|
user_input = "Airbus A330-200"
|
169
|
-
assert_equal ["A332"], Aircraft.
|
169
|
+
assert_equal ["A332"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
170
170
|
end
|
171
171
|
|
172
172
|
def test_003_user_input_matches_icao_codes
|
173
173
|
user_input = "Airbus A330-100"
|
174
|
-
assert_equal ["A332", "A333"], Aircraft.
|
174
|
+
assert_equal ["A332", "A333"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
175
175
|
end
|
176
176
|
|
177
177
|
def test_003_user_input_matches_icao_codes
|
178
178
|
user_input = "Airbus A340-200"
|
179
|
-
assert_equal ["A342"], Aircraft.
|
179
|
+
assert_equal ["A342"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
180
180
|
end
|
181
181
|
|
182
182
|
def test_003_user_input_matches_icao_codes
|
183
183
|
user_input = "Airbus A340-100"
|
184
|
-
assert_equal ["A342", "A343", "A345", "A346"], Aircraft.
|
184
|
+
assert_equal ["A342", "A343", "A345", "A346"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
185
185
|
end
|
186
186
|
|
187
187
|
def test_003_user_input_matches_icao_codes
|
188
188
|
user_input = "Airbus A380-800"
|
189
|
-
assert_equal ["A388"], Aircraft.
|
189
|
+
assert_equal ["A388"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
190
190
|
end
|
191
191
|
|
192
192
|
def test_003_user_input_matches_icao_codes
|
193
193
|
user_input = "Airbus A380-100"
|
194
|
-
assert_equal ["A388"], Aircraft.
|
194
|
+
assert_equal ["A388"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
195
195
|
end
|
196
196
|
|
197
197
|
def test_003_user_input_matches_icao_codes
|
198
198
|
user_input = "Airbus A300C"
|
199
|
-
assert_equal ["A30B"], Aircraft.
|
199
|
+
assert_equal ["A30B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
200
200
|
end
|
201
201
|
|
202
202
|
def test_003_user_input_matches_icao_codes
|
203
203
|
user_input = "Airbus A300X"
|
204
|
-
assert_equal ["A306", "A30B"], Aircraft.
|
204
|
+
assert_equal ["A306", "A30B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
205
205
|
end
|
206
206
|
|
207
207
|
def test_003_user_input_matches_icao_codes
|
208
208
|
user_input = "Airbus A318"
|
209
|
-
assert_equal ["A318"], Aircraft.
|
209
|
+
assert_equal ["A318"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
210
210
|
end
|
211
211
|
|
212
212
|
def test_003_user_input_matches_icao_codes
|
213
213
|
user_input = "Airbus A311"
|
214
|
-
assert_equal [], Aircraft.
|
214
|
+
assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
215
215
|
end
|
216
216
|
|
217
217
|
def test_003_user_input_matches_icao_codes
|
218
218
|
user_input = "Airbus A321"
|
219
|
-
assert_equal ["A321"], Aircraft.
|
219
|
+
assert_equal ["A321"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
220
220
|
end
|
221
221
|
|
222
222
|
def test_003_user_input_matches_icao_codes
|
223
223
|
user_input = "Airbus A322"
|
224
|
-
assert_equal [], Aircraft.
|
224
|
+
assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
225
225
|
end
|
226
226
|
|
227
227
|
def test_003_user_input_matches_icao_codes
|
228
228
|
user_input = "Airbus A350"
|
229
|
-
assert_equal [], Aircraft.
|
229
|
+
assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
230
230
|
end
|
231
231
|
|
232
232
|
def test_003_user_input_matches_icao_codes
|
233
233
|
user_input = "Canadair CL601"
|
234
|
-
assert_equal ["CL60"], Aircraft.
|
234
|
+
assert_equal ["CL60"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
235
235
|
end
|
236
236
|
|
237
237
|
def test_003_user_input_matches_icao_codes
|
238
238
|
user_input = "Canadair CL215"
|
239
|
-
assert_equal ["CL2P"], Aircraft.
|
239
|
+
assert_equal ["CL2P"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
240
240
|
end
|
241
241
|
|
242
242
|
def test_003_user_input_matches_icao_codes
|
243
243
|
user_input = "Canadair CL215 turbine"
|
244
|
-
assert_equal ["CL2T"], Aircraft.
|
244
|
+
assert_equal ["CL2T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
245
245
|
end
|
246
246
|
|
247
247
|
def test_003_user_input_matches_icao_codes
|
248
248
|
user_input = "Canadair CL44O"
|
249
|
-
assert_equal ["CL4G"], Aircraft.
|
249
|
+
assert_equal ["CL4G"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
250
250
|
end
|
251
251
|
|
252
252
|
def test_003_user_input_matches_icao_codes
|
253
253
|
user_input = "Canadair CRJ440"
|
254
|
-
assert_equal ["CRJ2"], Aircraft.
|
254
|
+
assert_equal ["CRJ2"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
255
255
|
end
|
256
256
|
|
257
257
|
def test_003_user_input_matches_icao_codes
|
258
258
|
user_input = "Canadair CRJ111"
|
259
|
-
assert_equal ["CRJ1"], Aircraft.
|
259
|
+
assert_equal ["CRJ1"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
260
260
|
end
|
261
261
|
|
262
262
|
def test_003_user_input_matches_icao_codes
|
263
263
|
user_input = "Embraer ERJ130"
|
264
|
-
assert_equal ["E135"], Aircraft.
|
264
|
+
assert_equal ["E135"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
265
265
|
end
|
266
266
|
|
267
267
|
def test_003_user_input_matches_icao_codes
|
268
268
|
user_input = "Embraer ERJ145XR"
|
269
|
-
assert_equal ["E45X"], Aircraft.
|
269
|
+
assert_equal ["E45X"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
270
270
|
end
|
271
271
|
|
272
272
|
def test_003_user_input_matches_icao_codes
|
273
273
|
user_input = "Embraer EMB110"
|
274
|
-
assert_equal ["E110"], Aircraft.
|
274
|
+
assert_equal ["E110"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
275
275
|
end
|
276
276
|
|
277
277
|
def test_003_user_input_matches_icao_codes
|
278
278
|
user_input = "Embraer Bandeirante"
|
279
|
-
assert_equal ["E110"], Aircraft.
|
279
|
+
assert_equal ["E110"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
280
280
|
end
|
281
281
|
|
282
282
|
def test_003_user_input_matches_icao_codes
|
283
283
|
user_input = "Embraer EMB120"
|
284
|
-
assert_equal ["E120"], Aircraft.
|
284
|
+
assert_equal ["E120"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
285
285
|
end
|
286
286
|
|
287
287
|
def test_003_user_input_matches_icao_codes
|
288
288
|
user_input = "Embraer Brasilia"
|
289
|
-
assert_equal ["E120"], Aircraft.
|
289
|
+
assert_equal ["E120"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
290
290
|
end
|
291
291
|
|
292
292
|
def test_003_user_input_matches_icao_codes
|
293
293
|
user_input = "Embraer EMB121"
|
294
|
-
assert_equal ["E121"], Aircraft.
|
294
|
+
assert_equal ["E121"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
295
295
|
end
|
296
296
|
|
297
297
|
def test_003_user_input_matches_icao_codes
|
298
298
|
user_input = "Embraer Xingu"
|
299
|
-
assert_equal ["E121"], Aircraft.
|
299
|
+
assert_equal ["E121"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
300
300
|
end
|
301
301
|
|
302
302
|
def test_003_user_input_matches_icao_codes
|
303
303
|
user_input = "Embraer EMB201"
|
304
|
-
assert_equal ["IPAN"], Aircraft.
|
304
|
+
assert_equal ["IPAN"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
305
305
|
end
|
306
306
|
|
307
307
|
def test_003_user_input_matches_icao_codes
|
308
308
|
user_input = "Embraer Ipanema"
|
309
|
-
assert_equal ["IPAN"], Aircraft.
|
309
|
+
assert_equal ["IPAN"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
310
310
|
end
|
311
311
|
|
312
312
|
def test_003_user_input_matches_icao_codes
|
313
313
|
user_input = "McDonnell Douglas DC3"
|
314
|
-
assert_equal ["DC3", "DC3S"], Aircraft.
|
314
|
+
assert_equal ["DC3", "DC3S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
315
315
|
end
|
316
316
|
|
317
317
|
def test_003_user_input_matches_icao_codes
|
318
318
|
user_input = "McDonnell Douglas DC3S"
|
319
|
-
assert_equal ["DC3S"], Aircraft.
|
319
|
+
assert_equal ["DC3S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
320
320
|
end
|
321
321
|
|
322
322
|
def test_003_user_input_matches_icao_codes
|
323
323
|
user_input = "McDonnell Douglas DC8-50"
|
324
|
-
assert_equal ["DC85"], Aircraft.
|
324
|
+
assert_equal ["DC85"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
325
325
|
end
|
326
326
|
|
327
327
|
def test_003_user_input_matches_icao_codes
|
328
328
|
user_input = "McDonnell Douglas DC8-40"
|
329
|
-
assert_equal ["DC85", "DC86", "DC87", "DC8Q"], Aircraft.
|
329
|
+
assert_equal ["DC85", "DC86", "DC87", "DC8Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
330
330
|
end
|
331
331
|
|
332
332
|
def test_003_user_input_matches_icao_codes
|
333
333
|
user_input = "McDonnell Douglas DC8 Stage 3"
|
334
|
-
assert_equal ["DC8Q"], Aircraft.
|
334
|
+
assert_equal ["DC8Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
335
335
|
end
|
336
336
|
|
337
337
|
def test_003_user_input_matches_icao_codes
|
338
338
|
user_input = "McDonnell Douglas DC9-10"
|
339
|
-
assert_equal ["DC91"], Aircraft.
|
339
|
+
assert_equal ["DC91"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
340
340
|
end
|
341
341
|
|
342
342
|
def test_003_user_input_matches_icao_codes
|
343
343
|
user_input = "McDonnell Douglas DC9-60"
|
344
|
-
assert_equal ["DC91", "DC92", "DC93", "DC94", "DC95", "DC9Q"], Aircraft.
|
344
|
+
assert_equal ["DC91", "DC92", "DC93", "DC94", "DC95", "DC9Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
345
345
|
end
|
346
346
|
|
347
347
|
def test_003_user_input_matches_icao_codes
|
348
348
|
user_input = "McDonnell Douglas DC9 Stage 3"
|
349
|
-
assert_equal ["DC9Q"], Aircraft.
|
349
|
+
assert_equal ["DC9Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
350
350
|
end
|
351
351
|
|
352
352
|
def test_003_user_input_matches_icao_codes
|
353
353
|
user_input = "McDonnell Douglas DC10-10"
|
354
|
-
assert_equal ["DC10"], Aircraft.
|
354
|
+
assert_equal ["DC10"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
355
355
|
end
|
356
356
|
|
357
357
|
def test_003_user_input_matches_icao_codes
|
358
358
|
user_input = "McDonnell Douglas DC4"
|
359
|
-
assert_equal ["DC4"], Aircraft.
|
359
|
+
assert_equal ["DC4"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
360
360
|
end
|
361
361
|
|
362
362
|
def test_003_user_input_matches_icao_codes
|
363
363
|
user_input = "McDonnell Douglas DC5"
|
364
|
-
assert_equal [], Aircraft.
|
364
|
+
assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
365
365
|
end
|
366
366
|
|
367
367
|
def test_003_user_input_matches_icao_codes
|
368
368
|
user_input = "McDonnell Douglas MD81"
|
369
|
-
assert_equal ["MD81"], Aircraft.
|
369
|
+
assert_equal ["MD81"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
370
370
|
end
|
371
371
|
|
372
372
|
def test_003_user_input_matches_icao_codes
|
373
373
|
user_input = "McDonnell Douglas MD84"
|
374
|
-
assert_equal ["MD81", "MD82", "MD83", "MD87", "MD88"], Aircraft.
|
374
|
+
assert_equal ["MD81", "MD82", "MD83", "MD87", "MD88"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
375
375
|
end
|
376
376
|
|
377
377
|
def test_003_user_input_matches_icao_codes
|
378
378
|
user_input = "McDonnell Douglas MD11"
|
379
|
-
assert_equal ["MD11"], Aircraft.
|
379
|
+
assert_equal ["MD11"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
380
380
|
end
|
381
381
|
|
382
382
|
def test_003_user_input_matches_icao_codes
|
383
383
|
user_input = "McDonnell Douglas MD90"
|
384
|
-
assert_equal ["MD90"], Aircraft.
|
384
|
+
assert_equal ["MD90"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
385
385
|
end
|
386
386
|
|
387
387
|
def test_003_user_input_matches_icao_codes
|
388
388
|
user_input = "McDonnell Douglas C133"
|
389
|
-
assert_equal ["C133"], Aircraft.
|
389
|
+
assert_equal ["C133"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
390
390
|
end
|
391
391
|
|
392
392
|
def test_003_user_input_matches_icao_codes
|
393
393
|
user_input = "McDonnell Douglas Cargomaster"
|
394
|
-
assert_equal ["C133"], Aircraft.
|
394
|
+
assert_equal ["C133"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
395
395
|
end
|
396
396
|
|
397
397
|
def test_003_user_input_matches_icao_codes
|
398
398
|
user_input = "de Havilland DHC8-100"
|
399
|
-
assert_equal ["DH8A"], Aircraft.
|
399
|
+
assert_equal ["DH8A"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
400
400
|
end
|
401
401
|
|
402
402
|
def test_003_user_input_matches_icao_codes
|
403
403
|
user_input = "de Havilland DHC8-500"
|
404
|
-
assert_equal ["DH8A", "DH8B", "DH8C", "DH8D"], Aircraft.
|
404
|
+
assert_equal ["DH8A", "DH8B", "DH8C", "DH8D"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
405
405
|
end
|
406
406
|
|
407
407
|
def test_003_user_input_matches_icao_codes
|
408
408
|
user_input = "de Havilland DHC1"
|
409
|
-
assert_equal ["DHC1"], Aircraft.
|
409
|
+
assert_equal ["DHC1"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
410
410
|
end
|
411
411
|
|
412
412
|
def test_003_user_input_matches_icao_codes
|
413
413
|
user_input = "de Havilland Chipmunk"
|
414
|
-
assert_equal ["DHC1"], Aircraft.
|
414
|
+
assert_equal ["DHC1"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
415
415
|
end
|
416
416
|
|
417
417
|
def test_003_user_input_matches_icao_codes
|
418
418
|
user_input = "de Havilland DHC2 mk1"
|
419
|
-
assert_equal ["DHC2"], Aircraft.
|
419
|
+
assert_equal ["DHC2"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
420
420
|
end
|
421
421
|
|
422
422
|
def test_003_user_input_matches_icao_codes
|
423
423
|
user_input = "de Havilland DHC2 mk3"
|
424
|
-
assert_equal ["DH2T"], Aircraft.
|
424
|
+
assert_equal ["DH2T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
425
425
|
end
|
426
426
|
|
427
427
|
def test_003_user_input_matches_icao_codes
|
428
428
|
user_input = "de Havilland Beaver"
|
429
|
-
assert_equal ["DHC2"], Aircraft.
|
429
|
+
assert_equal ["DHC2"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
430
430
|
end
|
431
431
|
|
432
432
|
def test_003_user_input_matches_icao_codes
|
433
433
|
user_input = "de Havilland Turbo Beaver"
|
434
|
-
assert_equal ["DH2T"], Aircraft.
|
434
|
+
assert_equal ["DH2T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
435
435
|
end
|
436
436
|
|
437
437
|
def test_003_user_input_matches_icao_codes
|
438
438
|
user_input = "de Havilland DHC2"
|
439
|
-
assert_equal ["DHC2", "DH2T"], Aircraft.
|
439
|
+
assert_equal ["DHC2", "DH2T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
440
440
|
end
|
441
441
|
|
442
442
|
def test_003_user_input_matches_icao_codes
|
443
443
|
user_input = "de Havilland DHC3"
|
444
|
-
assert_equal ["DHC3", "DH3T"], Aircraft.
|
444
|
+
assert_equal ["DHC3", "DH3T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
445
445
|
end
|
446
446
|
|
447
447
|
def test_003_user_input_matches_icao_codes
|
448
448
|
user_input = "de Havilland Otter"
|
449
|
-
assert_equal ["DHC3"], Aircraft.
|
449
|
+
assert_equal ["DHC3"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
450
450
|
end
|
451
451
|
|
452
452
|
def test_003_user_input_matches_icao_codes
|
453
453
|
user_input = "de Havilland Turbo Otter"
|
454
|
-
assert_equal ["DH3T"], Aircraft.
|
454
|
+
assert_equal ["DH3T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
455
455
|
end
|
456
456
|
|
457
457
|
def test_003_user_input_matches_icao_codes
|
458
458
|
user_input = "de Havilland DHC4"
|
459
|
-
assert_equal ["DHC4"], Aircraft.
|
459
|
+
assert_equal ["DHC4"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
460
460
|
end
|
461
461
|
|
462
462
|
def test_003_user_input_matches_icao_codes
|
463
463
|
user_input = "de Havilland Caribou"
|
464
|
-
assert_equal ["DHC4"], Aircraft.
|
464
|
+
assert_equal ["DHC4"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
465
465
|
end
|
466
466
|
|
467
467
|
def test_003_user_input_matches_icao_codes
|
468
468
|
user_input = "de Havilland DHC5"
|
469
|
-
assert_equal ["DHC5"], Aircraft.
|
469
|
+
assert_equal ["DHC5"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
470
470
|
end
|
471
471
|
|
472
472
|
def test_003_user_input_matches_icao_codes
|
473
473
|
user_input = "de Havilland Buffalo"
|
474
|
-
assert_equal ["DHC5"], Aircraft.
|
474
|
+
assert_equal ["DHC5"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
475
475
|
end
|
476
476
|
|
477
477
|
def test_003_user_input_matches_icao_codes
|
478
478
|
user_input = "de Havilland DHC6"
|
479
|
-
assert_equal ["DHC6"], Aircraft.
|
479
|
+
assert_equal ["DHC6"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
480
480
|
end
|
481
481
|
|
482
482
|
def test_003_user_input_matches_icao_codes
|
483
483
|
user_input = "de Havilland Twin"
|
484
|
-
assert_equal ["DHC6"], Aircraft.
|
484
|
+
assert_equal ["DHC6"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
485
485
|
end
|
486
486
|
|
487
487
|
def test_003_user_input_matches_icao_codes
|
488
488
|
user_input = "de Havilland DHC7"
|
489
|
-
assert_equal ["DHC7"], Aircraft.
|
489
|
+
assert_equal ["DHC7"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
490
490
|
end
|
491
491
|
|
492
492
|
def test_003_user_input_matches_icao_codes
|
493
493
|
user_input = "de Havilland Dash 7"
|
494
|
-
assert_equal ["DHC7"], Aircraft.
|
494
|
+
assert_equal ["DHC7"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
495
495
|
end
|
496
496
|
|
497
497
|
def test_003_user_input_matches_icao_codes
|
498
498
|
user_input = "aerospatiale atr42"
|
499
|
-
assert_equal ["AT43", "AT44", "AT45"], Aircraft.
|
499
|
+
assert_equal ["AT43", "AT44", "AT45"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
500
500
|
end
|
501
501
|
|
502
502
|
def test_003_user_input_matches_icao_codes
|
503
503
|
user_input = "aerospatiale atr72"
|
504
|
-
assert_equal ["AT72"], Aircraft.
|
504
|
+
assert_equal ["AT72"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
505
505
|
end
|
506
506
|
|
507
507
|
def test_003_user_input_matches_icao_codes
|
508
508
|
user_input = "bae bae 146 100"
|
509
|
-
assert_equal ["B461"], Aircraft.
|
509
|
+
assert_equal ["B461"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
510
510
|
end
|
511
511
|
|
512
512
|
def test_003_user_input_matches_icao_codes
|
513
513
|
user_input = "bae bae146-400"
|
514
|
-
assert_equal ["B461", "B462", "B463"], Aircraft.
|
514
|
+
assert_equal ["B461", "B462", "B463"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
515
515
|
end
|
516
516
|
|
517
517
|
def test_003_user_input_matches_icao_codes
|
518
518
|
user_input = "bae jetstream 32"
|
519
|
-
assert_equal ["JS32"], Aircraft.
|
519
|
+
assert_equal ["JS32"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
520
520
|
end
|
521
521
|
|
522
522
|
def test_003_user_input_matches_icao_codes
|
523
523
|
user_input = "bae jetstream super 31"
|
524
|
-
assert_equal ["JS32"], Aircraft.
|
524
|
+
assert_equal ["JS32"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
525
525
|
end
|
526
526
|
|
527
527
|
def test_003_user_input_matches_icao_codes
|
528
528
|
user_input = "bae jetstream 31"
|
529
|
-
assert_equal ["JS31"], Aircraft.
|
529
|
+
assert_equal ["JS31"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
530
530
|
end
|
531
531
|
|
532
532
|
def test_003_user_input_matches_icao_codes
|
533
533
|
user_input = "bae jetstream 41"
|
534
|
-
assert_equal ["JS41"], Aircraft.
|
534
|
+
assert_equal ["JS41"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
535
535
|
end
|
536
536
|
|
537
537
|
def test_003_user_input_matches_icao_codes
|
538
538
|
user_input = "bae atp"
|
539
|
-
assert_equal ["atp"], Aircraft.
|
539
|
+
assert_equal ["atp"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
540
540
|
end
|
541
541
|
|
542
542
|
def test_003_user_input_matches_icao_codes
|
543
543
|
user_input = "bae bac one-eleven"
|
544
|
-
assert_equal ["BA11"], Aircraft.
|
544
|
+
assert_equal ["BA11"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
545
545
|
end
|
546
546
|
|
547
547
|
def test_003_user_input_matches_icao_codes
|
548
548
|
user_input = "bae bac111"
|
549
|
-
assert_equal ["BA11"], Aircraft.
|
549
|
+
assert_equal ["BA11"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
550
550
|
end
|
551
551
|
|
552
552
|
def test_003_user_input_matches_icao_codes
|
553
553
|
user_input = "bae bae125-1000"
|
554
|
-
assert_equal ["H25C"], Aircraft.
|
554
|
+
assert_equal ["H25C"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
555
555
|
end
|
556
556
|
|
557
557
|
def test_003_user_input_matches_icao_codes
|
558
558
|
user_input = "bae bae125-70"
|
559
|
-
assert_equal ["H25B"], Aircraft.
|
559
|
+
assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
560
560
|
end
|
561
561
|
|
562
562
|
def test_003_user_input_matches_icao_codes
|
563
563
|
user_input = "bae bae125-75"
|
564
|
-
assert_equal ["H25B"], Aircraft.
|
564
|
+
assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
565
565
|
end
|
566
566
|
|
567
567
|
def test_003_user_input_matches_icao_codes
|
568
568
|
user_input = "bae bae125-80"
|
569
|
-
assert_equal ["H25B"], Aircraft.
|
569
|
+
assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
570
570
|
end
|
571
571
|
|
572
572
|
def test_003_user_input_matches_icao_codes
|
573
573
|
user_input = "bae bae125-85"
|
574
|
-
assert_equal ["H25B"], Aircraft.
|
574
|
+
assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
575
575
|
end
|
576
576
|
|
577
577
|
def test_003_user_input_matches_icao_codes
|
578
578
|
user_input = "bae bae125-90"
|
579
|
-
assert_equal ["H25B"], Aircraft.
|
579
|
+
assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
580
580
|
end
|
581
581
|
|
582
582
|
def test_003_user_input_matches_icao_codes
|
583
583
|
user_input = "bae bae125-95"
|
584
|
-
assert_equal [], Aircraft.
|
584
|
+
assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
585
585
|
end
|
586
586
|
|
587
587
|
def test_003_user_input_matches_icao_codes
|
588
588
|
user_input = "bae bae125"
|
589
|
-
assert_equal [], Aircraft.
|
589
|
+
assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
590
590
|
end
|
591
591
|
|
592
592
|
def test_003_user_input_matches_icao_codes
|
593
593
|
user_input = "fokker 50"
|
594
|
-
assert_equal ["F50"], Aircraft.
|
594
|
+
assert_equal ["F50"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
595
595
|
end
|
596
596
|
|
597
597
|
def test_003_user_input_matches_icao_codes
|
598
598
|
user_input = "fokker 61"
|
599
|
-
assert_equal ["F60"], Aircraft.
|
599
|
+
assert_equal ["F60"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
600
600
|
end
|
601
601
|
|
602
602
|
def test_003_user_input_matches_icao_codes
|
603
603
|
user_input = "fokker 72"
|
604
|
-
assert_equal ["F70"], Aircraft.
|
604
|
+
assert_equal ["F70"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
605
605
|
end
|
606
606
|
|
607
607
|
def test_003_user_input_matches_icao_codes
|
608
608
|
user_input = "fokker 103"
|
609
|
-
assert_equal ["F100"], Aircraft.
|
609
|
+
assert_equal ["F100"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
610
610
|
end
|
611
611
|
|
612
612
|
def test_003_user_input_matches_icao_codes
|
613
613
|
user_input = "fokker 80"
|
614
|
-
assert_equal [], Aircraft.
|
614
|
+
assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
615
615
|
end
|
616
616
|
|
617
617
|
def test_003_user_input_matches_icao_codes
|
618
618
|
user_input = "fokker F27"
|
619
|
-
assert_equal ["F27"], Aircraft.
|
619
|
+
assert_equal ["F27"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
620
620
|
end
|
621
621
|
|
622
622
|
def test_003_user_input_matches_icao_codes
|
623
623
|
user_input = "fokker Friendship"
|
624
|
-
assert_equal ["F27"], Aircraft.
|
624
|
+
assert_equal ["F27"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
625
625
|
end
|
626
626
|
|
627
627
|
def test_003_user_input_matches_icao_codes
|
628
628
|
user_input = "fokker F28"
|
629
|
-
assert_equal ["F28"], Aircraft.
|
629
|
+
assert_equal ["F28"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
630
630
|
end
|
631
631
|
|
632
632
|
def test_003_user_input_matches_icao_codes
|
633
633
|
user_input = "fokker Fellowship"
|
634
|
-
assert_equal ["F28"], Aircraft.
|
634
|
+
assert_equal ["F28"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
635
635
|
end
|
636
636
|
|
637
637
|
def test_003_user_input_matches_icao_codes
|
638
638
|
user_input = "fokker super"
|
639
|
-
assert_equal ["SUNV"], Aircraft.
|
639
|
+
assert_equal ["SUNV"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
640
640
|
end
|
641
641
|
|
642
642
|
def test_003_user_input_matches_icao_codes
|
643
643
|
user_input = "saab 2000"
|
644
|
-
assert_equal ["SB20"], Aircraft.
|
644
|
+
assert_equal ["SB20"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
645
645
|
end
|
646
646
|
|
647
647
|
def test_003_user_input_matches_icao_codes
|
648
648
|
user_input = "saab 340"
|
649
|
-
assert_equal ["SF34"], Aircraft.
|
649
|
+
assert_equal ["SF34"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
650
650
|
end
|
651
651
|
|
652
652
|
def test_003_user_input_matches_icao_codes
|
653
653
|
user_input = "saab 91"
|
654
|
-
assert_equal ["SB91"], Aircraft.
|
654
|
+
assert_equal ["SB91"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
655
655
|
end
|
656
656
|
|
657
657
|
def test_003_user_input_matches_icao_codes
|
658
658
|
user_input = "saab safir"
|
659
|
-
assert_equal ["SB91"], Aircraft.
|
659
|
+
assert_equal ["SB91"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
660
660
|
end
|
661
661
|
|
662
662
|
def test_003_user_input_matches_icao_codes
|
663
663
|
user_input = "hawker beechcraft 1900"
|
664
|
-
assert_equal ["B190"], Aircraft.
|
664
|
+
assert_equal ["B190"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
665
665
|
end
|
666
666
|
|
667
667
|
def test_003_user_input_matches_icao_codes
|
668
668
|
user_input = "cessna 401"
|
669
|
-
assert_equal ["C402"], Aircraft.
|
669
|
+
assert_equal ["C402"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
670
670
|
end
|
671
671
|
|
672
672
|
def test_003_user_input_matches_icao_codes
|
673
673
|
user_input = "cessna 402"
|
674
|
-
assert_equal ["C402"], Aircraft.
|
674
|
+
assert_equal ["C402"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
675
675
|
end
|
676
676
|
|
677
677
|
def test_003_user_input_matches_icao_codes
|
678
678
|
user_input = "cessna 208"
|
679
|
-
assert_equal ["C208"], Aircraft.
|
679
|
+
assert_equal ["C208"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
680
680
|
end
|
681
681
|
|
682
682
|
def test_003_user_input_matches_icao_codes
|
683
683
|
user_input = "cessna caravan"
|
684
|
-
assert_equal ["C208"], Aircraft.
|
684
|
+
assert_equal ["C208"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
685
685
|
end
|
686
686
|
|
687
687
|
def test_003_user_input_matches_icao_codes
|
688
688
|
user_input = "cessna cargomaster"
|
689
|
-
assert_equal ["C208"], Aircraft.
|
689
|
+
assert_equal ["C208"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
690
690
|
end
|
691
691
|
|
692
692
|
def test_003_user_input_matches_icao_codes
|
693
693
|
user_input = "cessna grand caravan"
|
694
|
-
assert_equal ["C208"], Aircraft.
|
694
|
+
assert_equal ["C208"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
|
695
695
|
end
|
696
696
|
|
697
697
|
|
698
698
|
|
699
699
|
# def test_001_flight_segments_match_icao_codes
|
700
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.
|
701
|
+
# assert_equal %w{ B741 B742 B743 B744 B74D B74R B74S }, Aircraft.fuzzy_match(flight_segment_bts_aircraft_type_description).map(&:icao_code)
|
702
702
|
# end
|
703
703
|
#
|
704
704
|
# def test_003_user_input_matches_flight_segments
|
705
705
|
# user_input = '747'
|
706
|
-
# aircraft_suggested_by_user_input = Aircraft.
|
706
|
+
# aircraft_suggested_by_user_input = Aircraft.fuzzy_match(user_input)
|
707
707
|
#
|
708
708
|
# # this is why the following query should work...
|
709
709
|
# # FlightSegment.cohort(:aircraft => [ B731, B732 ])
|
@@ -720,7 +720,7 @@ class TestAircraftMatch < Test::Unit::TestCase
|
|
720
720
|
#
|
721
721
|
# def test_004_user_input_matches_fuel_use_equations
|
722
722
|
# user_input = '747'
|
723
|
-
# aircraft_suggested_by_user_input = Aircraft.
|
723
|
+
# aircraft_suggested_by_user_input = Aircraft.fuzzy_match(user_input)
|
724
724
|
#
|
725
725
|
# # see above for why this would work
|
726
726
|
# # ...
|