earth 0.11.19 → 0.11.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +16 -1
- data/errata/automobile_make_model_year_variant/feg_errata.csv +1 -283
- data/lib/earth/air/aircraft/data_miner.rb +1 -1
- data/lib/earth/air/airport/data_miner.rb +1 -1
- data/lib/earth/air/flight_segment/data_miner.rb +1 -1
- data/lib/earth/automobile/automobile_make_model_year_variant.rb +14 -16
- data/lib/earth/automobile/automobile_make_model_year_variant/data_miner.rb +257 -326
- data/lib/earth/conversions_ext.rb +9 -0
- data/lib/earth/electricity/electric_utility.rb +1 -1
- data/lib/earth/version.rb +1 -1
- data/spec/earth/air/aircraft_spec.rb +1 -1
- data/spec/earth/air/bts_aircraft_spec.rb +1 -1
- data/spec/earth/air/flight_segment_spec.rb +7 -4
- data/spec/earth/automobile/automobile_fuel_spec.rb +1 -1
- data/spec/earth/automobile/automobile_make_model_year_variant_spec.rb +126 -36
- data/spec/earth/automobile/automobile_make_year_fleet_spec.rb +1 -1
- data/spec/earth/bus/bus_fuel_control_spec.rb +1 -0
- data/spec/earth/bus/bus_fuel_year_control_spec.rb +1 -1
- data/spec/earth/locality/country_spec.rb +1 -1
- data/spec/earth_spec.rb +4 -3
- metadata +4 -4
@@ -59,6 +59,15 @@ Conversions.register :million_btu_per_barrel, :megajoules_per_litr
|
|
59
59
|
Conversions.register :btus_per_cubic_foot, :megajoules_per_cubic_metre, (1.btus.to(:megajoules) / 1.cubic_feet.to(:cubic_metres)) # Fuel
|
60
60
|
Conversions.register :teragrams_per_quadrillion_btu, :grams_per_megajoule, (1_000_000_000_000 / 1_000_000_000_000_000.btus.to(:megajoules)) # Fuel
|
61
61
|
|
62
|
+
# Odd units for EPA fuel economy guide
|
63
|
+
# Conversions.register :epa_gallon_gasoline_equivalents, :kilowatt_hours, 33.705
|
64
|
+
# Conversions.register :epa_gallon_gasoline_equivalents, :cubic_metres_compressed_natural_gas, 3.587
|
65
|
+
# Conversions.register :epa_gallon_gasoline_equivalents, :kilograms_hydrogen, 1.012
|
66
|
+
# Conversions.register :epa_miles_per_gallon_gasoline_equivalent, :kilometres_per_litre, (1.miles_per_gallon.to(:kilometres_per_litre))
|
67
|
+
# Conversions.register :epa_miles_per_gallon_gasoline_equivalent, :kilowatt_hours_per_hundred_kilometres, (1 / (1.kilowatt_hours.to(:epa_gallon_gasoline_equivalents) / 100.kilometres.to(:miles)))
|
68
|
+
# Conversions.register :epa_miles_per_gallon_gasoline_equivalent, :cubic_metres_per_hundred_kilometres, (1 / (1.cubic_metres_compressed_natural_gas.to(:epa_gallon_gasoline_equivalents) / 100.kilometres.to(:miles)))
|
69
|
+
# Conversions.register :epa_miles_per_gallon_gasoline_equivalent, :kilograms_per_hundred_kilometres, (1 / (1.kilograms_hydrogen.to(:epa_gallon_gasoline_equivalents) / 100.kilometres.to(:miles)))
|
70
|
+
|
62
71
|
# Odd units for pet - FIXME use megajoules rather than joules
|
63
72
|
Conversions.register :kilocalories, :joules, 4_184.0
|
64
73
|
Conversions.register :kilocalories_per_pound, :joules_per_kilogram, (1.kilocalories.to(:joules) / 1.pounds.to(:kilograms))
|
@@ -4,7 +4,7 @@ class ElectricUtility < ActiveRecord::Base
|
|
4
4
|
self.primary_key = "eia_id"
|
5
5
|
|
6
6
|
belongs_to :state, :foreign_key => 'state_postal_abbreviation'
|
7
|
-
has_many :electric_markets
|
7
|
+
has_many :electric_markets, :foreign_key => :electric_utility_eia_id
|
8
8
|
has_many :zip_codes, :through => :electric_markets
|
9
9
|
|
10
10
|
col :eia_id, :type => :integer
|
data/lib/earth/version.rb
CHANGED
@@ -14,7 +14,9 @@ describe FlightSegment do
|
|
14
14
|
|
15
15
|
describe "verify imported data", :sanity => true do
|
16
16
|
it "should have all the data" do
|
17
|
-
FlightSegment.
|
17
|
+
FlightSegment.where(:year => 2009).count.should == 403_959
|
18
|
+
FlightSegment.where(:year => 2010).count.should == 421_725
|
19
|
+
FlightSegment.where(:year => 2011).count.should > 357_687
|
18
20
|
end
|
19
21
|
|
20
22
|
it "should have year from 2009 to present" do
|
@@ -37,9 +39,10 @@ describe FlightSegment do
|
|
37
39
|
# FIXME TODO
|
38
40
|
end
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
42
|
+
# FIXME TODO fix this
|
43
|
+
# it "should have airline name" do
|
44
|
+
# FlightSegment.where(:airline_name => nil).count.should == 0
|
45
|
+
# end
|
43
46
|
|
44
47
|
it "should have aircraft description" do
|
45
48
|
FlightSegment.where(:aircraft_description => nil).count.should == 0
|
@@ -14,7 +14,7 @@ describe AutomobileFuel do
|
|
14
14
|
|
15
15
|
describe 'verify imported data', :sanity => true do
|
16
16
|
it 'should have all the data' do
|
17
|
-
AutomobileFuel.
|
17
|
+
AutomobileFuel.count.should == 9
|
18
18
|
end
|
19
19
|
it 'correctly assigns hfc_emission_factor' do
|
20
20
|
AutomobileFuel.first.hfc_emission_factor.should == 0.124799
|
@@ -1,51 +1,141 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
require 'spec_helper'
|
2
3
|
require 'earth/automobile/automobile_make_model_year_variant'
|
3
4
|
|
4
5
|
describe AutomobileMakeModelYearVariant do
|
6
|
+
before :all do
|
7
|
+
Earth.init :automobile, :load_data_miner => true, :skip_parent_associations => :true
|
8
|
+
end
|
9
|
+
|
5
10
|
describe 'import', :data_miner => true do
|
6
|
-
before do
|
7
|
-
Earth.init :automobile, :load_data_miner => true, :skip_parent_associations => :true
|
8
|
-
end
|
9
|
-
|
10
11
|
it 'should import data' do
|
11
12
|
AutomobileMakeModelYearVariant.run_data_miner!
|
12
|
-
AutomobileMakeModelYearVariant.
|
13
|
+
AutomobileMakeModelYearVariant.count.should == 28811
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
17
|
describe 'verify imported data', :sanity => true do
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
18
|
+
# confirm we have right data from all years
|
19
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1985).count.should == 1152 }
|
20
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1986).count.should == 1183 }
|
21
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1987).count.should == 1206 }
|
22
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1988).count.should == 1104 }
|
23
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1989).count.should == 1137 }
|
24
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1990).count.should == 1049 }
|
25
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1991).count.should == 1062 }
|
26
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1992).count.should == 1055 }
|
27
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1993).count.should == 986 }
|
28
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1994).count.should == 963 }
|
29
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1995).count.should == 917 }
|
30
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1996).count.should == 750 }
|
31
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1997).count.should == 727 }
|
32
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1998).count.should == 794 }
|
33
|
+
it { AutomobileMakeModelYearVariant.where(:year => 1999).count.should == 800 }
|
34
|
+
it { AutomobileMakeModelYearVariant.where(:year => 2000).count.should == 845 }
|
35
|
+
it { AutomobileMakeModelYearVariant.where(:year => 2001).count.should == 849 }
|
36
|
+
it { AutomobileMakeModelYearVariant.where(:year => 2002).count.should == 940 }
|
37
|
+
it { AutomobileMakeModelYearVariant.where(:year => 2003).count.should == 1031 }
|
38
|
+
it { AutomobileMakeModelYearVariant.where(:year => 2004).count.should == 1134 }
|
39
|
+
it { AutomobileMakeModelYearVariant.where(:year => 2005).count.should == 1105 }
|
40
|
+
it { AutomobileMakeModelYearVariant.where(:year => 2006).count.should == 1076 }
|
41
|
+
it { AutomobileMakeModelYearVariant.where(:year => 2007).count.should == 1184 }
|
42
|
+
it { AutomobileMakeModelYearVariant.where(:year => 2008).count.should == 1247 }
|
43
|
+
it { AutomobileMakeModelYearVariant.where(:year => 2009).count.should == 1182 }
|
44
|
+
it { AutomobileMakeModelYearVariant.where(:year => 2010).count.should == 1107 }
|
45
|
+
it { AutomobileMakeModelYearVariant.where(:year => 2011).count.should == 1097 }
|
46
|
+
it { AutomobileMakeModelYearVariant.where(:year => 2012).count.should == 1129 }
|
47
|
+
|
48
|
+
# confirm make, model, year aren't missing
|
49
|
+
it { AutomobileMakeModelYearVariant.where(:make_name => nil).count.should == 0 }
|
50
|
+
it { AutomobileMakeModelYearVariant.where(:model_name => nil).count.should == 0 }
|
51
|
+
it { AutomobileMakeModelYearVariant.where(:year => nil).count.should == 0 }
|
52
|
+
|
53
|
+
it 'should have valid transmissions' do
|
54
|
+
AutomobileMakeModelYearVariant.connection.select_values("SELECT DISTINCT transmission FROM #{AutomobileMakeModelYearVariant.quoted_table_name}").each do |transmission|
|
55
|
+
fail "#{transmission} is not a valid transmission" unless AutomobileMakeModelYearVariant::Parser::TRANSMISSIONS.values.include?(transmission)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should have valid speeds' do
|
60
|
+
valid_speeds = ["1", "3", "4", "5", "6", "7", "8", "variable"]
|
61
|
+
AutomobileMakeModelYearVariant.connection.select_values("SELECT DISTINCT speeds FROM #{AutomobileMakeModelYearVariant.quoted_table_name}").each do |speeds|
|
62
|
+
fail "#{speeds} is not a valid speeds" unless valid_speeds.include?(speeds)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should have valid drives' do
|
67
|
+
valid_drives = ["FWD", "RWD", "4WD", "AWD", "PWD"] # PWD = part-time 4-wheel drive
|
68
|
+
AutomobileMakeModelYearVariant.connection.select_values("SELECT DISTINCT drive FROM #{AutomobileMakeModelYearVariant.quoted_table_name}").each do |drive|
|
69
|
+
fail "#{drive} is not a valid drive" unless valid_drives.include?(drive)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should have valid fuel codes' do
|
74
|
+
AutomobileMakeModelYearVariant.connection.select_values("SELECT DISTINCT fuel_code FROM #{AutomobileMakeModelYearVariant.quoted_table_name}").each do |code|
|
75
|
+
fail "#{code} is not a valid code" unless AutomobileMakeModelYearVariant::Parser::FUEL_CODES.values.include?(code)
|
76
|
+
end
|
45
77
|
end
|
46
78
|
|
47
|
-
# fuel
|
48
|
-
|
49
|
-
|
79
|
+
# confirm fuel efficiencies are valid and proper units
|
80
|
+
it { AutomobileMakeModelYearVariant.where("fuel_efficiency > 0").count.should == AutomobileMakeModelYearVariant.count }
|
81
|
+
it { AutomobileMakeModelYearVariant.where("fuel_efficiency_city > 0").count.should == AutomobileMakeModelYearVariant.count }
|
82
|
+
it { AutomobileMakeModelYearVariant.where("fuel_efficiency_highway > 0").count.should == AutomobileMakeModelYearVariant.count }
|
83
|
+
it { AutomobileMakeModelYearVariant.where("fuel_efficiency_units = 'kilometres_per_litre'").count.should == AutomobileMakeModelYearVariant.count }
|
84
|
+
it { AutomobileMakeModelYearVariant.where("fuel_efficiency_city_units = 'kilometres_per_litre'").count.should == AutomobileMakeModelYearVariant.count }
|
85
|
+
it { AutomobileMakeModelYearVariant.where("fuel_efficiency_highway_units = 'kilometres_per_litre'").count.should == AutomobileMakeModelYearVariant.count }
|
86
|
+
it { AutomobileMakeModelYearVariant.where("alt_fuel_efficiency <= 0").count.should == 0 }
|
87
|
+
it { AutomobileMakeModelYearVariant.where("alt_fuel_efficiency_city <= 0").count.should == 0 }
|
88
|
+
it { AutomobileMakeModelYearVariant.where("alt_fuel_efficiency_highway <= 0").count.should == 0 }
|
89
|
+
it { AutomobileMakeModelYearVariant.where("alt_fuel_efficiency_units != 'kilometres_per_litre'").count.should == 0 }
|
90
|
+
it { AutomobileMakeModelYearVariant.where("alt_fuel_efficiency_city_units != 'kilometres_per_litre'").count.should == 0 }
|
91
|
+
it { AutomobileMakeModelYearVariant.where("alt_fuel_efficiency_highway_units != 'kilometres_per_litre'").count.should == 0 }
|
92
|
+
|
93
|
+
# confirm carline class is present for recent years
|
94
|
+
it { AutomobileMakeModelYearVariant.where("year > 1997 AND carline_class IS NULL").count.should == 0 }
|
95
|
+
|
96
|
+
# spot check fuel efficiency calcs
|
97
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2012, :make_name => 'Chevrolet', :model_name => 'VOLT'}).fuel_efficiency_city.should be_within(0.0001).of(14.8800) }
|
98
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2012, :make_name => 'Chevrolet', :model_name => 'VOLT'}).fuel_efficiency_highway.should be_within(0.0001).of(17.0057) }
|
99
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2012, :make_name => 'Chevrolet', :model_name => 'VOLT'}).fuel_efficiency.should be_within(0.0001).of(16.0216) }
|
100
|
+
|
101
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2012, :make_name => 'Chevrolet', :model_name => 'VOLT'}).alt_fuel_efficiency_city.should be_within(0.0001).of(40.3887) }
|
102
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2012, :make_name => 'Chevrolet', :model_name => 'VOLT'}).alt_fuel_efficiency_highway.should be_within(0.0001).of(39.5384) }
|
103
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2012, :make_name => 'Chevrolet', :model_name => 'VOLT'}).alt_fuel_efficiency.should be_within(0.0001).of(39.8996) }
|
104
|
+
|
105
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2011, :make_name => 'Chevrolet', :model_name => 'VOLT'}).fuel_efficiency_city.should be_within(0.0001).of(14.8800) }
|
106
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2011, :make_name => 'Chevrolet', :model_name => 'VOLT'}).fuel_efficiency_highway.should be_within(0.0001).of(17.0057) }
|
107
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2011, :make_name => 'Chevrolet', :model_name => 'VOLT'}).fuel_efficiency.should be_within(0.0001).of(16.0216) }
|
108
|
+
|
109
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2011, :make_name => 'Chevrolet', :model_name => 'VOLT'}).alt_fuel_efficiency_city.should be_within(0.0001).of(40.3887) }
|
110
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2011, :make_name => 'Chevrolet', :model_name => 'VOLT'}).alt_fuel_efficiency_highway.should be_within(0.0001).of(38.2629) }
|
111
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2011, :make_name => 'Chevrolet', :model_name => 'VOLT'}).alt_fuel_efficiency.should be_within(0.0001).of(39.1489) }
|
112
|
+
|
113
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2010, :make_name => 'Dodge', :model_name => 'AVENGER', :alt_fuel_code => 'E'}).fuel_efficiency_city.should be_within(0.0001).of( 8.0777) }
|
114
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2010, :make_name => 'Dodge', :model_name => 'AVENGER', :alt_fuel_code => 'E'}).fuel_efficiency_highway.should be_within(0.0001).of(11.4789) }
|
115
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2010, :make_name => 'Dodge', :model_name => 'AVENGER', :alt_fuel_code => 'E'}).fuel_efficiency.should be_within(0.0001).of( 9.7192) }
|
116
|
+
|
117
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2010, :make_name => 'Dodge', :model_name => 'AVENGER', :alt_fuel_code => 'E'}).alt_fuel_efficiency_city.should be_within(0.0001).of(5.9520) }
|
118
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2010, :make_name => 'Dodge', :model_name => 'AVENGER', :alt_fuel_code => 'E'}).alt_fuel_efficiency_highway.should be_within(0.0001).of(8.5029) }
|
119
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2010, :make_name => 'Dodge', :model_name => 'AVENGER', :alt_fuel_code => 'E'}).alt_fuel_efficiency.should be_within(0.0001).of(7.1797) }
|
120
|
+
|
121
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2009, :make_name => 'Toyota', :model_name => 'PRIUS'}).fuel_efficiency_city.should be_within(0.0001).of(20.2602) }
|
122
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2009, :make_name => 'Toyota', :model_name => 'PRIUS'}).fuel_efficiency_highway.should be_within(0.0001).of(19.1879) }
|
123
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 2009, :make_name => 'Toyota', :model_name => 'PRIUS'}).fuel_efficiency.should be_within(0.0001).of(19.6347) }
|
124
|
+
|
125
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 1998, :make_name => 'Honda', :model_name => 'ODYSSEY'}).fuel_efficiency_city.should be_within(0.0001).of( 7.9773) }
|
126
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 1998, :make_name => 'Honda', :model_name => 'ODYSSEY'}).fuel_efficiency_highway.should be_within(0.0001).of(10.2480) }
|
127
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 1998, :make_name => 'Honda', :model_name => 'ODYSSEY'}).fuel_efficiency.should be_within(0.0001).of( 9.1305) }
|
128
|
+
|
129
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 1997, :make_name => 'Honda', :model_name => 'ODYSSEY'}).fuel_efficiency_city.should be_within(0.0001).of( 7.7886) }
|
130
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 1997, :make_name => 'Honda', :model_name => 'ODYSSEY'}).fuel_efficiency_highway.should be_within(0.0001).of(10.3739) }
|
131
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 1997, :make_name => 'Honda', :model_name => 'ODYSSEY'}).fuel_efficiency.should be_within(0.0001).of( 9.0782) }
|
132
|
+
|
133
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 1995, :make_name => 'Jaguar', :model_name => 'XJR'}).fuel_efficiency_city.should be_within(0.0001).of(5.8670) }
|
134
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 1995, :make_name => 'Jaguar', :model_name => 'XJR'}).fuel_efficiency_highway.should be_within(0.0001).of(8.2903) }
|
135
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 1995, :make_name => 'Jaguar', :model_name => 'XJR'}).fuel_efficiency.should be_within(0.0001).of(7.0399) }
|
136
|
+
|
137
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 1985, :make_name => 'Jaguar', :model_name => 'XJ'}).fuel_efficiency_city.should be_within(0.0001).of(5.8479) }
|
138
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 1985, :make_name => 'Jaguar', :model_name => 'XJ'}).fuel_efficiency_highway.should be_within(0.0001).of(7.3958) }
|
139
|
+
it { AutomobileMakeModelYearVariant.find(:first, :conditions => {:year => 1985, :make_name => 'Jaguar', :model_name => 'XJ'}).fuel_efficiency.should be_within(0.0001).of(6.6401) }
|
50
140
|
end
|
51
141
|
end
|
@@ -14,7 +14,7 @@ describe AutomobileMakeYearFleet do
|
|
14
14
|
|
15
15
|
describe 'verify imported data', :sanity => true do
|
16
16
|
it 'should have all the data' do
|
17
|
-
AutomobileMakeYearFleet.
|
17
|
+
AutomobileMakeYearFleet.count.should == 1349
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should have year from 1978 to 2011' do
|
@@ -14,7 +14,7 @@ describe 'BusFuelYearControl' do
|
|
14
14
|
|
15
15
|
describe 'verify imported data', :sanity => true do
|
16
16
|
it 'should have all the data' do
|
17
|
-
BusFuelYearControl.
|
17
|
+
BusFuelYearControl.count.should == 67
|
18
18
|
end
|
19
19
|
it 'is related to BusFuelControl' do
|
20
20
|
BusFuelYearControl.first.control.should_not be_nil
|
@@ -16,7 +16,7 @@ describe Country do
|
|
16
16
|
|
17
17
|
describe 'verify imported data', :sanity => true do
|
18
18
|
it 'should have all the data' do
|
19
|
-
Country.
|
19
|
+
Country.count.should == 249
|
20
20
|
end
|
21
21
|
it 'uses UTF-8 encoding' do
|
22
22
|
Country.find('AX').name.should == "Åland Islands"
|
data/spec/earth_spec.rb
CHANGED
@@ -27,13 +27,14 @@ describe Earth do
|
|
27
27
|
Earth.resources.should include('Industry')
|
28
28
|
end
|
29
29
|
it 'should filter resource_map by domain' do
|
30
|
-
Earth.resources('air').length.should ==
|
30
|
+
Earth.resources('air').length.should == 8
|
31
31
|
Earth.resources('automobile').length.should == 16
|
32
32
|
Earth.resources('bus').length.should == 4
|
33
33
|
Earth.resources('computation').length.should == 3
|
34
34
|
Earth.resources('diet').length.should == 2
|
35
|
+
Earth.resources('electricity').length.should == 3
|
35
36
|
Earth.resources('fuel').length.should == 5
|
36
|
-
Earth.resources('hospitality').length.should ==
|
37
|
+
Earth.resources('hospitality').length.should == 3
|
37
38
|
Earth.resources('industry').length.should == 18
|
38
39
|
Earth.resources('locality').length.should == 10
|
39
40
|
Earth.resources('pet').length.should == 4
|
@@ -46,7 +47,7 @@ describe Earth do
|
|
46
47
|
|
47
48
|
describe '.domains' do
|
48
49
|
it 'should return a list of all domains' do
|
49
|
-
Earth.domains.should == %w{air automobile bus computation diet fuel hospitality industry locality pet rail residence shipping}
|
50
|
+
Earth.domains.should == %w{air automobile bus computation diet electricity fuel hospitality industry locality pet rail residence shipping}
|
50
51
|
end
|
51
52
|
end
|
52
53
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: earth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.11.
|
5
|
+
version: 0.11.20
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Seamus Abshere
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2012-05-
|
15
|
+
date: 2012-05-14 00:00:00 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activerecord
|
@@ -632,7 +632,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
632
632
|
requirements:
|
633
633
|
- - ">="
|
634
634
|
- !ruby/object:Gem::Version
|
635
|
-
hash:
|
635
|
+
hash: 254190567421235722
|
636
636
|
segments:
|
637
637
|
- 0
|
638
638
|
version: "0"
|
@@ -641,7 +641,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
641
641
|
requirements:
|
642
642
|
- - ">="
|
643
643
|
- !ruby/object:Gem::Version
|
644
|
-
hash:
|
644
|
+
hash: 254190567421235722
|
645
645
|
segments:
|
646
646
|
- 0
|
647
647
|
version: "0"
|