Sha256: 2c3fac15a66e98d1c2d9974bda09a2ccc6a0898a25c7cff1eb0836ae80d4acba

Contents?: true

Size: 1.62 KB

Versions: 6

Compression:

Stored size: 1.62 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_for_domain' do
    context 'default domain' do
      it 'is a Hash' do
        expect(subject.metadata_for_domain).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_for_domain.empty?
            key = subject.metadata_for_domain.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_for_domain
    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

6 entries across 6 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta3 spec/support/shared_examples/major_object_examples.rb
ffi-gdal-1.0.0.beta1 spec/support/shared_examples/major_object_examples.rb
ffi-gdal-0.0.4 spec/support/shared_examples/major_object_examples.rb
ffi-gdal-0.0.3 spec/support/shared_examples/major_object_examples.rb
ffi-gdal-0.0.2 spec/support/shared_examples/major_object_examples.rb
ffi-gdal-0.0.1 spec/support/shared_examples/major_object_examples.rb