Sha256: dcc769fb3e8925ea850c9902d7f086a5a2be007248424992b1befa1d68e79366

Contents?: true

Size: 645 Bytes

Versions: 9

Compression:

Stored size: 645 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'gdal/options'

RSpec.describe GDAL::Options do
  describe '.to_hash' do
    subject { described_class.to_hash(pointer) }

    context 'options are set' do
      let(:pointer) { described_class.pointer(hash) }

      let(:hash) do
        {
          one: 'ONE',
          two: 'TWO'
        }
      end

      it 'returns the Ruby Hash' do
        expect(subject).to eq(hash)
      end
    end

    context 'pointer is null' do
      let(:pointer) { FFI::MemoryPointer.new(:string) }

      it 'returns an empty Hash' do
        expect(subject).to eq({})
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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