Sha256: 382d609d9495c0179fc2cee3ae5c44bcfe095bf2c7539a1c7b6decc19851feba

Contents?: true

Size: 1.99 KB

Versions: 9

Compression:

Stored size: 1.99 KB

Contents

# frozen_string_literal: true

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

9 entries across 9 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta16 spec/unit/ext/error_symbols_spec.rb
ffi-gdal-1.0.0.beta15 spec/unit/ext/error_symbols_spec.rb
ffi-gdal-1.0.0.beta14 spec/unit/ext/error_symbols_spec.rb
ffi-gdal-1.0.0.beta13 spec/unit/ext/error_symbols_spec.rb
ffi-gdal-1.0.0.beta12 spec/unit/ext/error_symbols_spec.rb
ffi-gdal-1.0.0.beta11 spec/unit/ext/error_symbols_spec.rb
ffi-gdal-1.0.0.beta10 spec/unit/ext/error_symbols_spec.rb
ffi-gdal-1.0.0.beta9 spec/unit/ext/error_symbols_spec.rb
ffi-gdal-1.0.0.beta8 spec/unit/ext/error_symbols_spec.rb