Sha256: a67d4d00f76869b3d90b72fa1755072e47ec75d203cfa7706475c8ef3a677eb9

Contents?: true

Size: 1.7 KB

Versions: 9

Compression:

Stored size: 1.7 KB

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'ogr/geometry_field_definition'
require 'ogr/spatial_reference'

RSpec.describe OGR::GeometryFieldDefinition do
  subject(:geometry_field_definition) { described_class.new('test gfld') }

  describe '#destroy!' do
    it 'sets the c_pointer to nil' do
      subject.destroy!
      expect(subject.instance_variable_get(:@c_pointer)).
        to be_nil
    end
  end

  describe '#name' do
    it 'returns the name' do
      expect(subject.name).to eq 'test gfld'
    end
  end

  describe '#name= + #name' do
    it 'assigns a new name' do
      subject.name = 'bobo'
      expect(subject.name).to eq 'bobo'
    end
  end

  describe '#type' do
    it 'returns the type' do
      expect(subject.type).to eq :wkbUnknown
    end
  end

  describe '#type= + #type' do
    it 'assigns a new type' do
      subject.type = :wkbPolygon
      expect(subject.type).to eq :wkbPolygon
    end
  end

  describe '#spatial_reference' do
    context 'default' do
      subject { geometry_field_definition.spatial_reference }
      it { is_expected.to be_nil }
    end
  end

  describe '#spatial_reference= + #spatial_reference' do
    it 'assigns the new SpatialReference' do
      new_spatial_reference = OGR::SpatialReference.new_from_epsg 4326
      subject.spatial_reference = new_spatial_reference
      expect(subject.spatial_reference.authority_code.to_i).to eq 4326
    end
  end

  describe '#ignored?' do
    context 'default' do
      it { is_expected.to_not be_ignored }
    end
  end

  describe '#ignore=' do
    context 'setting to true' do
      it 'sets the value to true' do
        subject.ignore = true
        expect(subject).to be_ignored
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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