Sha256: 0ac23b3b2381ca24cee2728137692cd24a09700cb40467e2ac1738d5ca4a29a1

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'
require 'earth/automobile/automobile_make_year_fleet'

describe AutomobileMakeYearFleet do
  before :all do
    AutomobileMakeYearFleet.auto_upgrade!
  end
  
  describe 'import', :data_miner => true do
    before do
      require 'earth/automobile/automobile_make_year_fleet/data_miner'
    end
    
    it 'should import data' do
      AutomobileMakeYearFleet.run_data_miner!
      AutomobileMakeYearFleet.all.count.should == 1349
    end
  end
  
  describe 'verify imported data', :sanity => true do
    it 'should have year from 1978 to 2011' do
      AutomobileMakeYearFleet.where('year IS NULL OR year < 1978 OR year > 2011').count.should == 0
    end
    
    it 'should have volume greater than zero' do
      AutomobileMakeYearFleet.where('volume IS NULL OR volume <= 0').count.should == 0
    end
    
    it 'should have fuel efficiency greater than zero' do
      AutomobileMakeYearFleet.where('fuel_efficiency IS NULL OR fuel_efficiency <= 0').count.should == 0
    end
    
    it 'should have fuel efficiency units of kilometres per litre' do
      AutomobileMakeYearFleet.where("fuel_efficiency_units IS NULL OR fuel_efficiency_units != 'kilometres_per_litre'").count.should == 0
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
earth-0.11.18 spec/earth/automobile/automobile_make_year_fleet_spec.rb
earth-0.11.17 spec/earth/automobile/automobile_make_year_fleet_spec.rb