Sha256: 7e629c74088e23cb7b5e9fc4f543cd684f35108e2b1375c02cd0d7a793de25c1

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'
require 'gdal/driver'

RSpec.describe GDAL::Driver do
  describe '.count' do
    subject { described_class.count }
    it { is_expected.to be > 0 }
  end

  describe '.by_name' do
    context 'not a driver' do
      it 'raises a GDAL::InvalidDriverName' do
        expect { described_class.by_name('blargh') }.
          to raise_exception GDAL::InvalidDriverName
      end
    end

    context 'valid driver name' do
      subject { described_class.by_name('MEM') }
      it { is_expected.to be_an_instance_of GDAL::Driver }
    end
  end

  describe '.at_index' do
    context 'invalid index' do
      it 'raises a GDAL::InvalidDriverIndex' do
        expect { described_class.at_index 123_456 }.
          to raise_exception GDAL::InvalidDriverIndex
      end
    end

    context 'valid index' do
      subject { described_class.at_index(0) }
      it { is_expected.to be_an_instance_of GDAL::Driver }
    end
  end

  describe '.identify_driver' do
    context 'file is not supported' do
      subject { described_class.identify_driver(__FILE__) }
      it { is_expected.to be_nil }
    end

    context 'file is supported' do
      subject { described_class.identify_driver('spec/support/worldfiles/SR_50M/SR_50M.tif') }
      it { is_expected.to be_an_instance_of GDAL::Driver }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta7 spec/unit/gdal/driver_spec.rb
ffi-gdal-1.0.0.beta6 spec/unit/gdal/driver_spec.rb
ffi-gdal-1.0.0.beta5 spec/unit/gdal/driver_spec.rb
ffi-gdal-1.0.0.beta4 spec/unit/gdal/driver_spec.rb