Sha256: bbbc80508ff9070f679340fd0404dc0aed19c485cb690d70c142f60184709802

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe GeoConcerns::Processors::BaseGeoProcessor do
  before do
    class TestProcessor
      include Hydra::Derivatives::Processors::ShellBasedProcessor
      include GeoConcerns::Processors::Ogr
      def directives
      end

      def source_path
      end
    end

    allow(subject).to receive(:directives).and_return(directives)
    allow(subject).to receive(:source_path).and_return(file_name)
  end

  after { Object.send(:remove_const, :TestProcessor) }

  subject { TestProcessor.new }

  let(:directives) { { format: 'png', size: '200x400' } }
  let(:output_file) { 'output/geo.png' }
  let(:file_name) { 'files/geo.zip' }
  let(:options) { { output_size: '150 150', output_srid: 'EPSG:4326' } }

  describe '#reproject' do
    it 'executes a reproject command' do
      command = "env SHAPE_ENCODING= ogr2ogr -q -nln  -f 'ESRI Shapefile' "\
                  "-t_srs EPSG:4326 'output/geo.png' 'files/geo.zip'"
      expect(subject.class).to receive(:execute).with command
      subject.class.reproject(file_name, output_file, options)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
geo_concerns-0.0.6 spec/processors/geo_concerns/processors/ogr_spec.rb
geo_concerns-0.0.5 spec/processors/geo_concerns/processors/ogr_spec.rb
geo_concerns-0.0.4 spec/processors/geo_concerns/processors/ogr_spec.rb
geo_concerns-0.0.3 spec/processors/geo_concerns/processors/ogr_spec.rb
geo_concerns-0.0.2 spec/processors/geo_concerns/processors/ogr_spec.rb