Sha256: a5de9ce6583a8558f779316967ced733ecca1ce4a057fcaa0eda30ed2e457a07

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

require 'earth'
require 'earth/locality/petroleum_administration_for_defense_district'

describe Sniff do
  let(:dirigible_path) { File.expand_path '../fixtures/dirigible', __FILE__ }
  let(:sniff) do
    sniff = Sniff.new(dirigible_path, :fixtures_path => dirigible_path + '/lib/test_support/db/fixtures', :project => 'sniff')
    sniff.connect
    sniff
  end
    
  before :all do
    $:.unshift File.join(dirigible_path, 'lib')
    require File.join('dirigible')
    DataMiner.logger = Logger.new $stdout
  end

  describe '.path' do
    it 'returns a path relative to sniff root' do
      Sniff.stub!(:root).and_return File.join('/path','to','my','gems','sniff')
      Sniff.path('lib','sniff','stuff.rb').split(/[\/\\]/).
        should == ['', 'path','to','my','gems','sniff','lib','sniff','stuff.rb']
    end
  end

  describe '#migrate!' do
    it 'loads a schema for the emitter record' do
      sniff.migrate!
      require File.join(dirigible_path, 'features', 'support', 'dirigible_record')
      DirigibleRecord.table_exists?.should be_true
    end
  end
  describe '#seed!' do
    it 'loads fixtures' do
      sniff.seed!
      PetroleumAdministrationForDefenseDistrict.count.should == 7
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sniff-1.1.0 spec/sniff_spec.rb
sniff-1.0.1 spec/sniff_spec.rb
sniff-1.0.0 spec/sniff_spec.rb