Sha256: efb7bf81b0a27e4440bb1d912d757538d0a53bc3ac634ded053576ff53dc402d

Contents?: true

Size: 1.96 KB

Versions: 4

Compression:

Stored size: 1.96 KB

Contents

require 'spec_helper'
require 'ext/error_symbols'

RSpec.describe Symbol do
  describe '#handle_result' do
    context ':OGRERR_NONE' do
      subject { :OGRERR_NONE.handle_result }
      it { is_expected.to eq true }
    end

    context ':OGRERR_NOT_ENOUGH_DATA' do
      it 'raises an OGR::NotEnoughData exception' do
        expect { :OGRERR_NOT_ENOUGH_DATA.handle_result }.
          to raise_exception OGR::NotEnoughData
      end
    end

    context ':OGRERR_NOT_ENOUGH_MEMORY' do
      it 'raises an NoMemoryError exception' do
        expect { :OGRERR_NOT_ENOUGH_MEMORY.handle_result }.
          to raise_exception NoMemoryError
      end
    end

    context ':OGRERR_UNSUPPORTED_GEOMETRY_TYPE' do
      it 'raises an OGR::UnsupportedGeometryType exception' do
        expect { :OGRERR_UNSUPPORTED_GEOMETRY_TYPE.handle_result }.
          to raise_exception OGR::UnsupportedGeometryType
      end
    end

    context ':OGRERR_UNSUPPORTED_OPERATION' do
      it 'raises an OGR::UnsupportedOperation exception' do
        expect { :OGRERR_UNSUPPORTED_OPERATION.handle_result }.
          to raise_exception OGR::UnsupportedOperation
      end
    end

    context ':OGRERR_CORRUPT_DATA' do
      it 'raises an OGR::CorruptData exception' do
        expect { :OGRERR_CORRUPT_DATA.handle_result }.
          to raise_exception OGR::CorruptData
      end
    end

    context ':OGRERR_FAILURE' do
      it 'raises an OGR::Failure exception' do
        expect { :OGRERR_FAILURE.handle_result }.
          to raise_exception OGR::Failure
      end
    end

    context ':OGRERR_UNSUPPORTED_SRS' do
      it 'raises an OGR::UnsupportedSRS exception' do
        expect { :OGRERR_UNSUPPORTED_SRS.handle_result }.
          to raise_exception OGR::UnsupportedSRS
      end
    end

    context ':OGRERR_INVALID_HANDLE' do
      it 'raises an OGR::InvalidHandle exception' do
        expect { :OGRERR_INVALID_HANDLE.handle_result }.
          to raise_exception OGR::InvalidHandle
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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