Sha256: e85d94ed7609b9848078561a703bb6b630b17459acc766dd138aa2bba3c393aa

Contents?: true

Size: 914 Bytes

Versions: 6

Compression:

Stored size: 914 Bytes

Contents

require 'spec_helper'
require 'open3'

describe GeoWorks::Processors::Raster::Info do
  let(:path) { 'test.tif' }
  let(:info_doc) { read_test_data_fixture('gdalinfo.txt') }

  subject { described_class.new(path) }

  context 'when initializing a new info class' do
    it 'shells out to gdalinfo and sets the doc variable to the output string' do
      expect(Open3).to receive(:capture3).with("gdalinfo -mm #{path}")
        .and_return([info_doc, '', ''])
      expect(subject.doc).to eq(info_doc)
    end
  end

  context 'after intialization' do
    before do
      allow(subject).to receive(:doc).and_return(info_doc)
    end

    describe '#min_max' do
      it 'returns with min and max values' do
        expect(subject.min_max).to eq('354.000 900.000')
      end
    end

    describe '#size' do
      it 'returns raster size' do
        expect(subject.size).to eq('310 266')
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
geo_works-0.2.0 spec/processors/geo_works/processors/raster/info_spec.rb
geo_works-0.1.4 spec/processors/geo_works/processors/raster/info_spec.rb
geo_works-0.1.3 spec/processors/geo_works/processors/raster/info_spec.rb
geo_works-0.1.2 spec/processors/geo_works/processors/raster/info_spec.rb
geo_works-0.1.1 spec/processors/geo_works/processors/raster/info_spec.rb
geo_works-0.1.0 spec/processors/geo_works/processors/raster/info_spec.rb