Sha256: 41a2e587d59c9b6ac2fb633c52c782db7d1d74a293f66b1f85d4b2472bb73ee5

Contents?: true

Size: 1.99 KB

Versions: 4

Compression:

Stored size: 1.99 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 '.resource_map' do
    it 'should get a list of resource_map' do
      resource_map = Earth.resource_map
      resource_map.keys.count.should == 91
      resource_map['FuelType'].should == 'fuel'
    end
    it 'should exclude data_miner files' do
      Earth.resource_map.keys.should_not include('DataMiner')
    end
  end

  describe '.search' do
    it 'should get a list of all resource names' do
      Earth.search.length.should == 91
      Earth.search.should include('Aircraft')
      Earth.search.should include('Industry')
    end
    it 'should filter resource_map by domain' do
      Earth.search('air').length.should == 10
      Earth.search('automobile').length.should == 16
      Earth.search('bus').length.should == 4
      Earth.search('computation').length.should == 3
      Earth.search('diet').length.should == 2
      Earth.search('fuel').length.should == 5
      Earth.search('hospitality').length.should == 3
      Earth.search('industry').length.should == 10
      Earth.search('locality').length.should == 10
      Earth.search('pet').length.should == 4
      Earth.search('rail').length.should == 12
      Earth.search('residence').length.should == 9
      Earth.search('shipping').length.should == 3
      Earth.search('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

4 entries across 4 versions & 1 rubygems

Version Path
earth-0.11.4 spec/earth_spec.rb
earth-0.11.3 spec/earth_spec.rb
earth-0.11.2 spec/earth_spec.rb
earth-0.11.1 spec/earth_spec.rb