Sha256: 01e6ba74d6ad08b8ce6ca9445476781f9f1473b707d7cec796278017f887a5f6

Contents?: true

Size: 974 Bytes

Versions: 4

Compression:

Stored size: 974 Bytes

Contents

require 'spec_helper'
require 'earth/hospitality/country_lodging_class'

describe CountryLodgingClass do
  before :all do
    CountryLodgingClass.auto_upgrade!
  end
  
  describe "when importing data", :data_miner => true do
    before do
      require 'earth/hospitality/country_lodging_class/data_miner'
    end
    
    it "imports all naics codes" do
      CountryLodgingClass.run_data_miner!
      CountryLodgingClass.count.should == 3
    end
  end
  
  describe "verify imported data", :sanity => true do
    it "should have fuel intensities" do
      us_hotel = CountryLodgingClass.find 'US Hotel'
      us_hotel.fuel_oil_intensity.should be_within(0.00001).of(0.25014)
      us_hotel.fuel_oil_intensity_units.should == 'litres_per_occupied_room_night'
    end
    
    it "should have the correct total weighting for the US" do
      CountryLodgingClass.where(:country_iso_3166_code => 'US').sum(&:weighting).should == be_within(0.1).of(89209.2)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
earth-0.11.18 spec/earth/hospitality/country_lodging_class_spec.rb
earth-0.11.17 spec/earth/hospitality/country_lodging_class_spec.rb
earth-0.11.16 spec/earth/hospitality/country_lodging_class_spec.rb
earth-0.11.15 spec/earth/hospitality/country_lodging_class_spec.rb