Sha256: 580f18f9e12aed6c11ea7628336634af760c18ca97fc83150712f32d186eb46c

Contents?: true

Size: 1.44 KB

Versions: 4

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

RSpec.shared_examples 'a major object' do
  describe '#metadata_domain_list' do
    it 'is an Array of Strings' do
      expect(subject.metadata_domain_list).to be_an Array

      subject.metadata_domain_list.each do |mdl|
        expect(mdl).to be_a String
      end
    end
  end

  describe '#metadata' do
    context 'default domain' do
      it 'is a Hash' do
        expect(subject.metadata).to be_a Hash
      end
    end
  end

  describe '#metadata_item' do
    context 'default domain' do
      context 'first item in metadata list' do
        it 'is a String' do
          unless subject.metadata.empty?
            key = subject.metadata.keys.first

            expect(subject.metadata_item(key)).to be_a String
          end
        end
      end
    end
  end

  describe '#all_metadata' do
    it 'is a Hash' do
      expect(subject.all_metadata).to be_a Hash
    end

    it 'has a DEFAULT key' do
      expect(subject.all_metadata[:DEFAULT]).to eq subject.metadata
    end
  end

  describe '#description' do
    it 'is a String' do
      expect(subject.description).to be_a String
    end
  end

  describe '#description=' do
    context 'new description is a string' do
      it 'sets the items description' do
        subject.description = 'a test description'
        expect(subject.description).to eq 'a test description'
      end
    end
  end

  describe '#null?' do
    it { is_expected.to_not be_null }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta11 spec/support/shared_examples/gdal/major_object_examples.rb
ffi-gdal-1.0.0.beta10 spec/support/shared_examples/gdal/major_object_examples.rb
ffi-gdal-1.0.0.beta9 spec/support/shared_examples/gdal/major_object_examples.rb
ffi-gdal-1.0.0.beta8 spec/support/shared_examples/gdal/major_object_examples.rb