earth 0.11.18 → 0.11.19
Sign up to get free protection for your applications and to get access to all the features.
- data/DEVELOPERS.markdown +19 -0
- data/Rakefile +2 -25
- data/errata/electricity/electric_market/nrel_errata.csv +1 -0
- data/errata/electricity/electric_utility/eia_errata.csv +1 -0
- data/lib/earth.rb +3 -1
- data/lib/earth/air/flight_segment.rb +1 -0
- data/lib/earth/air/flight_segment/data_miner.rb +1 -2
- data/lib/earth/electricity.rb +3 -0
- data/lib/earth/electricity/electric_market.rb +12 -0
- data/lib/earth/electricity/electric_market/data_miner.rb +21 -0
- data/lib/earth/electricity/electric_utility.rb +24 -0
- data/lib/earth/electricity/electric_utility/data_miner.rb +26 -0
- data/lib/earth/electricity/green_button_adoption.rb +20 -0
- data/lib/earth/electricity/green_button_adoption/data_miner.rb +19 -0
- data/lib/earth/locality/zip_code.rb +2 -0
- data/lib/earth/rail/national_transit_database_company.rb +3 -2
- data/lib/earth/residence/residential_energy_consumption_survey_response/data_miner.rb +1 -1
- data/lib/earth/version.rb +1 -1
- data/spec/earth/air/aircraft_spec.rb +6 -5
- data/spec/earth/air/airport_spec.rb +5 -6
- data/spec/earth/air/bts_aircraft_spec.rb +7 -6
- data/spec/earth/air/flight_distance_class_spec.rb +5 -6
- data/spec/earth/air/flight_segment_spec.rb +5 -6
- data/spec/earth/automobile/automobile_fuel_spec.rb +11 -4
- data/spec/earth/automobile/automobile_make_model_year_variant_spec.rb +1 -5
- data/spec/earth/automobile/automobile_make_year_fleet_spec.rb +5 -6
- data/spec/earth/automobile/automobile_type_fuel_year_age_spec.rb +14 -8
- data/spec/earth/bus/bus_fuel_control_spec.rb +13 -6
- data/spec/earth/bus/bus_fuel_spec.rb +23 -0
- data/spec/earth/bus/bus_fuel_year_control_spec.rb +16 -9
- data/spec/earth/electricity/electric_market_spec.rb +25 -0
- data/spec/earth/electricity/electric_utility_spec.rb +54 -0
- data/spec/earth/electricity/green_button_adoption_spec.rb +26 -0
- data/spec/earth/fuel/fuel_spec.rb +9 -9
- data/spec/earth/hospitality/commercial_building_energy_consumption_survey_response_spec.rb +4 -6
- data/spec/earth/hospitality/country_lodging_class_spec.rb +5 -6
- data/spec/earth/industry/industry_spec.rb +6 -5
- data/spec/earth/industry/mecs_energy_spec.rb +4 -4
- data/spec/earth/industry/mecs_ratio_spec.rb +4 -4
- data/spec/earth/industry/naics_2002_naics_2007_concordance_spec.rb +6 -5
- data/spec/earth/industry/naics_2002_sic_1987_concordance_spec.rb +6 -5
- data/spec/earth/industry/naics_2002_spec.rb +6 -5
- data/spec/earth/industry/naics_2007_spec.rb +6 -5
- data/spec/earth/industry/sic_1987_spec.rb +4 -6
- data/spec/earth/locality/country_spec.rb +4 -6
- data/spec/earth/locality/state_spec.rb +4 -6
- data/spec/earth/locality/zip_code_spec.rb +4 -6
- data/spec/earth/pet/species_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +216 -361
- data/features/automobile_fuel.feature +0 -144
- data/features/automobile_make.feature +0 -24
- data/features/automobile_make_model.feature +0 -24
- data/features/automobile_make_model_year.feature +0 -34
- data/features/automobile_make_year.feature +0 -34
- data/features/automobile_size_class.feature +0 -59
- data/features/automobile_size_class_year.feature +0 -34
- data/features/automobile_type_fuel_control.feature +0 -34
- data/features/automobile_type_fuel_year.feature +0 -124
- data/features/automobile_type_fuel_year_age.feature +0 -94
- data/features/automobile_type_fuel_year_control.feature +0 -74
- data/features/automobile_type_year.feature +0 -64
- data/features/bus_class.feature +0 -39
- data/features/bus_fuel.feature +0 -114
- data/features/carrier.feature +0 -64
- data/features/carrier_mode.feature +0 -64
- data/features/computation_carrier.feature +0 -14
- data/features/computation_carrier_instance_class.feature +0 -24
- data/features/egrid_region.feature +0 -20
- data/features/egrid_subregion.feature +0 -134
- data/features/fuel_year.feature +0 -54
- data/features/greenhouse_gas.feature +0 -44
- data/features/rail_class.feature +0 -64
- data/features/shipment_mode.feature +0 -34
- data/features/step_definitions/data_steps.rb +0 -35
- data/features/support/env.rb +0 -19
- data/spec/earth/bus/bus_class_spec.rb +0 -14
data/DEVELOPERS.markdown
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Developer notes
|
2
|
+
|
3
|
+
## Explicitly requiring cross-domain dependencies
|
4
|
+
|
5
|
+
Currently there's very little automatic resolution of dependencies. So, let's say you have
|
6
|
+
|
7
|
+
class ElectricMarket
|
8
|
+
belongs_to :state
|
9
|
+
end
|
10
|
+
|
11
|
+
You will need to require *locality* in 2 places:
|
12
|
+
|
13
|
+
# lib/earth/electricity/electric_market.rb
|
14
|
+
require 'earth/locality'
|
15
|
+
|
16
|
+
# lib/earth/electricity/electric_market/data_miner.rb
|
17
|
+
require 'earth/locality/data_miner'
|
18
|
+
|
19
|
+
If you don't, `State`'s data miner script will be empty when it is called by `ElectricMarket.run_data_miner_on_belongs_to_associations!`
|
data/Rakefile
CHANGED
@@ -17,29 +17,6 @@ task :console do
|
|
17
17
|
IRB.start
|
18
18
|
end
|
19
19
|
|
20
|
-
require 'cucumber'
|
21
|
-
require 'cucumber/rake/task'
|
22
|
-
desc 'Run all cucumber tests'
|
23
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
24
|
-
if ENV['CUCUMBER_FORMAT']
|
25
|
-
t.cucumber_opts = "features --format #{ENV['CUCUMBER_FORMAT']}"
|
26
|
-
else
|
27
|
-
t.cucumber_opts = 'features --format pretty'
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
directory 'log/'
|
32
|
-
task :features => 'log/'
|
33
|
-
|
34
|
-
if RUBY_VERSION =~ /^1\.8/
|
35
|
-
desc "Run cucumber tests with RCov"
|
36
|
-
Cucumber::Rake::Task.new(:features_with_coverage) do |t|
|
37
|
-
t.cucumber_opts = "features --format pretty"
|
38
|
-
t.rcov = true
|
39
|
-
t.rcov_opts = ['--exclude', 'features']
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
20
|
require 'rspec/core/rake_task'
|
44
21
|
desc "Run all examples"
|
45
22
|
RSpec::Core::RakeTask.new(:examples) do |c|
|
@@ -59,11 +36,11 @@ if RUBY_VERSION =~ /^1\.8/
|
|
59
36
|
end
|
60
37
|
end
|
61
38
|
|
62
|
-
task :test =>
|
39
|
+
task :test => :examples
|
63
40
|
task :default => :test
|
64
41
|
|
65
|
-
require 'rake/rdoctask'
|
66
42
|
require 'earth/version'
|
43
|
+
require 'rdoc/task'
|
67
44
|
Rake::RDocTask.new do |rdoc|
|
68
45
|
rdoc.rdoc_dir = 'rdoc'
|
69
46
|
rdoc.title = "earth #{Earth::VERSION}"
|
@@ -0,0 +1 @@
|
|
1
|
+
date,name,email,type,section,action,x,y,condition,notes
|
@@ -0,0 +1 @@
|
|
1
|
+
date,name,email,type,section,action,x,y,condition,notes
|
data/lib/earth.rb
CHANGED
@@ -72,7 +72,9 @@ module Earth
|
|
72
72
|
::Object.const_defined?(resource)
|
73
73
|
end.each do |resource|
|
74
74
|
resource_model = resource.constantize
|
75
|
-
|
75
|
+
unless options[:skip_parent_associations]
|
76
|
+
resource_model.data_miner_script.append_once :process, :run_data_miner_on_parent_associations!
|
77
|
+
end
|
76
78
|
if options[:load_data_miner]
|
77
79
|
resource_model.data_miner_script.prepend_once :process, :auto_upgrade!
|
78
80
|
else
|
@@ -186,8 +186,7 @@ FlightSegment.class_eval do
|
|
186
186
|
process "Start from scratch" do
|
187
187
|
delete_all
|
188
188
|
end
|
189
|
-
FlightSegment.form_data_per_month(
|
190
|
-
# FlightSegment.form_data_per_month(2009..::Time.now.year).each do |month, form_data|
|
189
|
+
FlightSegment.form_data_per_month(2009..::Time.now.year).each do |month, form_data|
|
191
190
|
import "T100 flight segment data for #{month.strftime('%B %Y')}",
|
192
191
|
:url => URL,
|
193
192
|
:form_data => form_data,
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'earth/locality'
|
2
|
+
|
3
|
+
class ElectricMarket < ActiveRecord::Base
|
4
|
+
self.primary_key = "id" # string
|
5
|
+
|
6
|
+
belongs_to :electric_utility, :foreign_key => 'electric_utility_eia_id'
|
7
|
+
belongs_to :zip_code, :foreign_key => 'zip_code_name'
|
8
|
+
|
9
|
+
col :id
|
10
|
+
col :electric_utility_eia_id, :type => :integer
|
11
|
+
col :zip_code_name
|
12
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'earth/locality/data_miner'
|
2
|
+
|
3
|
+
ElectricMarket.class_eval do
|
4
|
+
data_miner do
|
5
|
+
import 'IOU markets',
|
6
|
+
:url => 'http://en.openei.org/datasets/files/899/pub/iou_zipcodes.csv',
|
7
|
+
:errata => { :url => "file://#{Earth::ERRATA_DIR}/electricity/electric_market/nrel_errata.csv" } do
|
8
|
+
key 'id', :synthesize => proc { |row| row['compid'].to_i.to_s + '-' + row['zip'] }
|
9
|
+
store 'zip_code_name', :field_name => 'zip'
|
10
|
+
store 'electric_utility_eia_id', :field_name => 'compid'
|
11
|
+
end
|
12
|
+
|
13
|
+
import 'Non-IOU markets',
|
14
|
+
:url => 'http://en.openei.org/datasets/files/899/pub/non-iou_zipcodes.csv',
|
15
|
+
:errata => { :url => "file://#{Earth::ERRATA_DIR}/electricity/electric_market/nrel_errata.csv" } do
|
16
|
+
key 'id', :synthesize => proc { |row| row['compid'].to_i.to_s + '-' + row['zip'] }
|
17
|
+
store 'zip_code_name', :field_name => 'zip'
|
18
|
+
store 'electric_utility_eia_id', :field_name => 'compid'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'earth/locality'
|
2
|
+
|
3
|
+
class ElectricUtility < ActiveRecord::Base
|
4
|
+
self.primary_key = "eia_id"
|
5
|
+
|
6
|
+
belongs_to :state, :foreign_key => 'state_postal_abbreviation'
|
7
|
+
has_many :electric_markets
|
8
|
+
has_many :zip_codes, :through => :electric_markets
|
9
|
+
|
10
|
+
col :eia_id, :type => :integer
|
11
|
+
col :name
|
12
|
+
col :nickname
|
13
|
+
col :state_postal_abbreviation
|
14
|
+
col :nerc_region_abbreviation
|
15
|
+
col :second_nerc_region_abbreviation
|
16
|
+
|
17
|
+
def green_button_implementer?
|
18
|
+
GreenButtonAdoption.implemented? name, nickname
|
19
|
+
end
|
20
|
+
|
21
|
+
def green_button_committer?
|
22
|
+
GreenButtonAdoption.committed? name, nickname
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'earth/locality/data_miner'
|
2
|
+
|
3
|
+
ElectricUtility.class_eval do
|
4
|
+
data_miner do
|
5
|
+
process "make sure green button adoption is populated" do
|
6
|
+
GreenButtonAdoption.run_data_miner!
|
7
|
+
end
|
8
|
+
|
9
|
+
import 'EIA Form 861 records from 2010 (revised)',
|
10
|
+
:url => 'http://www.eia.gov/Ftproot/pub/electricity/f86110.zip',
|
11
|
+
:filename => 'file1_2010.xls',
|
12
|
+
:skip => 7,
|
13
|
+
:errata => { :url => "file://#{Earth::ERRATA_DIR}/electricity/electric_utility/eia_errata.csv" } do
|
14
|
+
key 'eia_id', :field_name => 'UTILITY_ID'
|
15
|
+
store 'name', :field_name => 'UTILITY_NAME'
|
16
|
+
store 'state_postal_abbreviation', :field_name => 'MAIL_STATE', :nullify => true
|
17
|
+
store 'nerc_region_abbreviation', :synthesize => proc { |row| (first_nerc = row['NERC_LOCATION'].match(/^(\w+)/))? first_nerc.captures[0] : nil }
|
18
|
+
store 'second_nerc_region_abbreviation', :synthesize => proc { |row| (second_nerc = row['NERC_LOCATION'].match(/^\w+ ?[&,\/] ?(\w+)$/)) ? second_nerc.captures[0] : nil }
|
19
|
+
end
|
20
|
+
|
21
|
+
import 'Aliases', :url => 'https://docs.google.com/spreadsheet/pub?key=0AtyCBJLCFHlwdEM5WjVxRjBKWVJRcTJ3c1BhUnlSVXc&single=true&gid=0&output=csv' do
|
22
|
+
key 'eia_id', :field_name => 'utility_id'
|
23
|
+
store 'nickname', :field_name => 'alias'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class GreenButtonAdoption < ActiveRecord::Base
|
2
|
+
self.primary_key = "electric_utility_name"
|
3
|
+
|
4
|
+
col :electric_utility_name
|
5
|
+
col :implemented, :type => :boolean
|
6
|
+
col :committed, :type => :boolean
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def implemented?(*names)
|
10
|
+
names.any? do |name|
|
11
|
+
find_by_electric_utility_name(name).try :implemented?
|
12
|
+
end
|
13
|
+
end
|
14
|
+
def committed?(*names)
|
15
|
+
names.any? do |name|
|
16
|
+
find_by_electric_utility_name(name).try :committed?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
GreenButtonAdoption.class_eval do
|
2
|
+
data_miner do
|
3
|
+
import 'Green Button implementers',
|
4
|
+
:url => 'http://greenbuttondata.org/greenadopt.html',
|
5
|
+
:row_css => '#adopt+p+h2+table li.implemented',
|
6
|
+
:headers => %w{electric_utility_name} do
|
7
|
+
key 'electric_utility_name'
|
8
|
+
store 'implemented', :static => true
|
9
|
+
end
|
10
|
+
|
11
|
+
import 'Green Button committers',
|
12
|
+
:url => 'http://greenbuttondata.org/greenadopt.html',
|
13
|
+
:row_css => '#adopt+p+h2+table li.committed',
|
14
|
+
:headers => %w{electric_utility_name} do
|
15
|
+
key 'electric_utility_name'
|
16
|
+
store 'committed', :static => true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -6,6 +6,8 @@ class ZipCode < ActiveRecord::Base
|
|
6
6
|
belongs_to :egrid_subregion, :foreign_key => 'egrid_subregion_abbreviation'
|
7
7
|
belongs_to :climate_division, :foreign_key => 'climate_division_name'
|
8
8
|
belongs_to :state, :foreign_key => 'state_postal_abbreviation'
|
9
|
+
has_many :electric_markets, :foreign_key => 'zip_code_name'
|
10
|
+
has_many :electric_utilities, :through => :electric_markets
|
9
11
|
|
10
12
|
def country
|
11
13
|
Country.united_states
|
@@ -22,11 +22,12 @@ class NationalTransitDatabaseCompany < ActiveRecord::Base
|
|
22
22
|
end
|
23
23
|
|
24
24
|
# Methods to look up units from from rail_records
|
25
|
+
# TODO this looks inefficient
|
25
26
|
[:rail_passenger_distance_units, :rail_vehicle_distance_units, :rail_vehicle_time_units, :rail_electricity_units, :rail_diesel_units].each do |method|
|
26
27
|
define_method method do
|
27
28
|
attribute = method.to_s.split('rail_')[1].to_sym
|
28
|
-
units = rail_records.map(&attribute).uniq
|
29
|
-
(units.
|
29
|
+
units = rail_records.map(&attribute).uniq.compact
|
30
|
+
(units.length == 1 and units[0].present?) ? units[0] : raise("Error: units missing or multiple units in #{name}'s NTD records")
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
@@ -4,7 +4,7 @@ ResidentialEnergyConsumptionSurveyResponse.class_eval do
|
|
4
4
|
# conversions are NOT performed here, since we first have to zero out legitimate skips
|
5
5
|
# otherwise you will get values like "999 pounds = 453.138778 kilograms" (where 999 is really a legit skip)
|
6
6
|
import 'the 2005 EIA Residential Energy Consumption Survey microdata',
|
7
|
-
:url => 'http://www.eia.
|
7
|
+
:url => 'http://www.eia.gov/emeu/recs/recspubuse05/datafiles/RECS05alldata.csv',
|
8
8
|
:headers => :upcase do
|
9
9
|
key 'id', :field_name => 'DOEID'
|
10
10
|
|
data/lib/earth/version.rb
CHANGED
@@ -2,17 +2,18 @@ require 'spec_helper'
|
|
2
2
|
require 'earth/air/aircraft'
|
3
3
|
|
4
4
|
describe Aircraft do
|
5
|
-
before :all do
|
6
|
-
Aircraft.auto_upgrade!
|
7
|
-
end
|
8
|
-
|
9
5
|
describe 'import', :data_miner => true do
|
10
6
|
before do
|
11
|
-
|
7
|
+
Earth.init :air, :load_data_miner => true, :skip_parent_associations => :true
|
12
8
|
end
|
13
9
|
|
14
10
|
it 'should import data' do
|
15
11
|
Aircraft.run_data_miner!
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "verify imported data", :sanity => true do
|
16
|
+
it "should have all the data" do
|
16
17
|
Aircraft.all.count.should == 437
|
17
18
|
end
|
18
19
|
end
|
@@ -2,22 +2,21 @@ require 'spec_helper'
|
|
2
2
|
require 'earth/air/airport'
|
3
3
|
|
4
4
|
describe Airport do
|
5
|
-
before :all do
|
6
|
-
Airport.auto_upgrade!
|
7
|
-
end
|
8
|
-
|
9
5
|
describe "when importing data", :data_miner => true do
|
10
6
|
before do
|
11
|
-
|
7
|
+
Earth.init :air, :load_data_miner => true, :skip_parent_associations => :true
|
12
8
|
end
|
13
9
|
|
14
10
|
it "imports all airports" do
|
15
11
|
Airport.run_data_miner!
|
16
|
-
Airport.count.should == 5324
|
17
12
|
end
|
18
13
|
end
|
19
14
|
|
20
15
|
describe "verify imported data", :sanity => true do
|
16
|
+
it "should have all the data" do
|
17
|
+
Airport.count.should == 5324
|
18
|
+
end
|
19
|
+
|
21
20
|
it "should have name" do
|
22
21
|
Airport.where(:name => nil).count.should == 0
|
23
22
|
end
|
@@ -2,18 +2,19 @@ require 'spec_helper'
|
|
2
2
|
require 'earth/air/bts_aircraft'
|
3
3
|
|
4
4
|
describe BtsAircraft do
|
5
|
-
before :all do
|
6
|
-
BtsAircraft.auto_upgrade!
|
7
|
-
end
|
8
|
-
|
9
5
|
describe 'import', :data_miner => true do
|
10
6
|
before do
|
11
|
-
|
7
|
+
Earth.init :air, :load_data_miner => true, :skip_parent_associations => :true
|
12
8
|
end
|
13
9
|
|
14
10
|
it 'should import data' do
|
15
11
|
BtsAircraft.run_data_miner!
|
16
|
-
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'verify imported data', :sanity => true do
|
16
|
+
it 'should have all the data' do
|
17
|
+
BtsAircraft.all.count.should == 379
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
@@ -2,22 +2,21 @@ require 'spec_helper'
|
|
2
2
|
require 'earth/air/flight_distance_class'
|
3
3
|
|
4
4
|
describe FlightDistanceClass do
|
5
|
-
before :all do
|
6
|
-
FlightDistanceClass.auto_upgrade!
|
7
|
-
end
|
8
|
-
|
9
5
|
describe "when importing data", :data_miner => true do
|
10
6
|
before do
|
11
|
-
|
7
|
+
Earth.init :air, :load_data_miner => true, :skip_parent_associations => :true
|
12
8
|
end
|
13
9
|
|
14
10
|
it "imports all naics codes" do
|
15
11
|
FlightDistanceClass.run_data_miner!
|
16
|
-
FlightDistanceClass.count.should == 2
|
17
12
|
end
|
18
13
|
end
|
19
14
|
|
20
15
|
describe "verify imported data", :sanity => true do
|
16
|
+
it "should have all the data" do
|
17
|
+
FlightDistanceClass.count.should == 2
|
18
|
+
end
|
19
|
+
|
21
20
|
it "should have distances > 0" do
|
22
21
|
FlightDistanceClass.where('distance <= 0 OR distance IS NULL').count.should == 0
|
23
22
|
end
|
@@ -2,22 +2,21 @@ require 'spec_helper'
|
|
2
2
|
require 'earth/air/flight_segment'
|
3
3
|
|
4
4
|
describe FlightSegment do
|
5
|
-
before :all do
|
6
|
-
FlightSegment.auto_upgrade!
|
7
|
-
end
|
8
|
-
|
9
5
|
describe 'import', :data_miner => true do
|
10
6
|
before do
|
11
|
-
|
7
|
+
Earth.init :air, :load_data_miner => true, :skip_parent_associations => :true
|
12
8
|
end
|
13
9
|
|
14
10
|
it 'should import data' do
|
15
11
|
FlightSegment.run_data_miner!
|
16
|
-
FlightSegment.all.count.should == 1_149_003
|
17
12
|
end
|
18
13
|
end
|
19
14
|
|
20
15
|
describe "verify imported data", :sanity => true do
|
16
|
+
it "should have all the data" do
|
17
|
+
FlightSegment.all.count.should == 1_149_003
|
18
|
+
end
|
19
|
+
|
21
20
|
it "should have year from 2009 to present" do
|
22
21
|
FlightSegment.where("year IS NULL OR year < 2009 OR year > #{::Time.now.year}").count.should == 0
|
23
22
|
end
|
@@ -1,16 +1,23 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'earth/automobile'
|
3
|
-
require 'earth/automobile/data_miner'
|
4
3
|
|
5
4
|
describe AutomobileFuel do
|
6
5
|
describe 'import', :data_miner => true do
|
6
|
+
before do
|
7
|
+
Earth.init :automobile, :load_data_miner => true, :skip_parent_associations => :true
|
8
|
+
end
|
9
|
+
|
7
10
|
it 'should import data without problems' do
|
8
11
|
AutomobileFuel.run_data_miner!
|
9
|
-
AutomobileFuel.all.count.should > 0
|
10
12
|
end
|
11
|
-
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'verify imported data', :sanity => true do
|
16
|
+
it 'should have all the data' do
|
17
|
+
AutomobileFuel.all.count.should == 9
|
18
|
+
end
|
12
19
|
it 'correctly assigns hfc_emission_factor' do
|
13
|
-
AutomobileFuel.first.hfc_emission_factor.should == 0.
|
20
|
+
AutomobileFuel.first.hfc_emission_factor.should == 0.124799
|
14
21
|
end
|
15
22
|
end
|
16
23
|
end
|