Sha256: ef644b675d6bfe239894ac2d4e0e8b3ffcfad2f29724f8d51cc0a53b5d47df12

Contents?: true

Size: 1.47 KB

Versions: 2

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'
require 'earth/hospitality/commercial_building_energy_consumption_survey_response'

describe CommercialBuildingEnergyConsumptionSurveyResponse do
  describe "when importing data", :data_miner => true do
    before do
      Earth.init :hospitality, :load_data_miner => true, :skip_parent_associations => :true
    end
    
    it "imports all naics codes" do
      CommercialBuildingEnergyConsumptionSurveyResponse.run_data_miner!
    end
  end
  
  describe "verify imported data", :sanity => true do
    it "should have all the data" do
      CommercialBuildingEnergyConsumptionSurveyResponse.count.should == 5215
    end
    it "should have room nights and fuel intensities per room night for lodging_records" do
      spot_check = CommercialBuildingEnergyConsumptionSurveyResponse.lodging_records.first
      spot_check.room_nights.should == 6205
      spot_check.natural_gas_per_room_night.should be_within(0.00001).of(1.62234)
      spot_check.natural_gas_per_room_night_units.should == 'cubic_metres_per_room_night'
    end
  end
  
  describe ".lodging_records" do
    it "should return only records representing Hotels, Motels, and Inns with no other activity" do
      lodging_records = CommercialBuildingEnergyConsumptionSurveyResponse.lodging_records
      lodging_records.map(&:detailed_activity).uniq.sort.should == ['Hotel', 'Motel or inn']
      lodging_records.map(&:first_activity).uniq.should == [nil]
      lodging_records.count.should == 192
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
earth-0.11.20 spec/earth/hospitality/commercial_building_energy_consumption_survey_response_spec.rb
earth-0.11.19 spec/earth/hospitality/commercial_building_energy_consumption_survey_response_spec.rb