Sha256: b099ec028b818a6b1536927578b0d6368a4efde2a7c7ca47fc7befff10daa21d

Contents?: true

Size: 1.45 KB

Versions: 5

Compression:

Stored size: 1.45 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.resource_names.each { |k| k.constantize }
      end.should_not raise_error(NameError)
    end

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

  describe '.resources' do
    it 'should get a list of resources' do
      resources = Earth.resources
      resources.keys.count.should == 76
      resources['FuelType'][:domain].should == 'fuel'
    end
    it 'should exclude data_miner files' do
      Earth.resources.keys.should_not include('DataMiner')
    end
  end

  describe '.resource_names' do
    it 'should get a list of all resource names' do
      Earth.resource_names.count.should == 76
      Earth.resource_names.should include('Aircraft')
      Earth.resource_names.should include('Industry')
    end
    it 'should filter resources by domain' do
      Earth.resource_names(['fuel']).count.should == 5
      Earth.resource_names(['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

5 entries across 5 versions & 1 rubygems

Version Path
earth-0.5.0 spec/earth_spec.rb
earth-0.4.8 spec/earth_spec.rb
earth-0.4.7 spec/earth_spec.rb
earth-0.4.6 spec/earth_spec.rb
earth-0.4.5 spec/earth_spec.rb