Sha256: cdabc79c0731cc30432f179f48f9c0354c7c842451f3b19e6f7df9df1e2ee7ac

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 KB

Contents

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
      around :example do |example|
        original_description = subject.description
        example.run
        subject.description = original_description
      end

      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

2 entries across 2 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta5 spec/support/shared_examples/gdal/major_object_examples.rb
ffi-gdal-1.0.0.beta4 spec/support/shared_examples/gdal/major_object_examples.rb