Sha256: 517f2f9c9b22ec9c77ac2b59a374e00b4a09507e25a9d6eea2536cc222b720ee

Contents?: true

Size: 1.71 KB

Versions: 3

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'

describe Earth do
  describe '.init' do
    before :all do
      Earth.init :all, :apply_schemas => true
    end

    it 'should require all Earth models' do
      lambda do
        Earth.resources.each { |k| k.constantize }
      end.should_not raise_error(NameError)
    end

    it 'should include data_miner definitions' do
      lambda do
        Earth.resources.each { |k| k.constantize.should_receive(:data_miner) }
      end
      require 'earth/data_miner'
    end
  end

  describe '.resources' do
    it 'should get a list of all resource names' do
      Earth.resources.length.should == 96
      Earth.resources.should include('Aircraft')
      Earth.resources.should include('Industry')
    end
    it 'should filter resource_map by domain' do
      Earth.resources('air').length.should == 10
      Earth.resources('automobile').length.should == 16
      Earth.resources('bus').length.should == 4
      Earth.resources('computation').length.should == 3
      Earth.resources('diet').length.should == 2
      Earth.resources('fuel').length.should == 5
      Earth.resources('hospitality').length.should == 5
      Earth.resources('industry').length.should == 13
      Earth.resources('locality').length.should == 10
      Earth.resources('pet').length.should == 4
      Earth.resources('rail').length.should == 12
      Earth.resources('residence').length.should == 9
      Earth.resources('shipping').length.should == 3
      Earth.resources('fuel').should include('FuelType')
    end
  end

  describe '.domains' do
    it 'should return a list of all domains' do
      Earth.domains.should == %w{air automobile bus computation diet fuel hospitality industry locality pet rail residence shipping}
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
earth-0.11.11 spec/earth_spec.rb
earth-0.11.10 spec/earth_spec.rb
earth-0.11.9 spec/earth_spec.rb