Sha256: 461890ac058f4a95f8a3831ea72fac03172e956e1be8939d2c0dece14b8cb397

Contents?: true

Size: 1.6 KB

Versions: 4

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'
require 'earth/air/flight_segment'

describe FlightSegment do
  describe 'import', :data_miner => true do
    before do
      Earth.init :air, :load_data_miner => true, :skip_parent_associations => :true
    end
    
    it 'should import data' do
      FlightSegment.run_data_miner!
    end
  end
  
  describe "verify imported data", :sanity => true do
    it "should have all the data" do
      FlightSegment.where(:year => 2009).count.should == 403_959
      FlightSegment.where(:year => 2010).count.should == 421_725
      FlightSegment.where(:year => 2011).count.should > 357_687
    end
    
    it "should have year from 2009 to present" do
      FlightSegment.where("year IS NULL OR year < 2009 OR year > #{::Time.now.year}").count.should == 0
    end
    
    it "should have data through 7 months ago" do
      latest = Date.today << 7
      FlightSegment.maximum(:year).should == latest.year
      FlightSegment.where(:year => latest.year).maximum(:month).should == latest.month
    end
    
    it "should have origin airport in airports" do
      # FIXME TODO
    end
    
    it "should have destination airport in airports" do
      # FIXME TODO
    end
    
    it "should have origin country iso code in countries" do
      # FIXME TODO
    end
    
    it "should have destination country iso code in countries" do
      # FIXME TODO
    end
    
    it "should have airline name" do
      FlightSegment.where(:airline_name => nil).count.should == 0
    end
    
    it "should have aircraft description" do
      FlightSegment.where(:aircraft_description => nil).count.should == 0
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
earth-0.12.3 spec/earth/air/flight_segment_spec.rb
earth-0.12.2 spec/earth/air/flight_segment_spec.rb
earth-0.12.1 spec/earth/air/flight_segment_spec.rb
earth-0.12.0 spec/earth/air/flight_segment_spec.rb