Sha256: 5b2dfc1412393c604466dfee3bba9d4ee23412a97c17399e42bdb9a2552f4a22

Contents?: true

Size: 1.08 KB

Versions: 18

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe GeoConcerns::Processors::Zip do
  before do
    class TestProcessor
      include Hydra::Derivatives::Processors::ShellBasedProcessor
      include GeoConcerns::Processors::Zip
    end
  end

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

  subject { TestProcessor.new }
  let(:path) { 'files/test.zip' }
  let(:output_file) { 'output/test.tif' }

  describe '#unzip' do
    let(:command) { 'unzip -qq -j -d "output/test_out" "files/test.zip"' }

    context 'given an input and output path' do
      it 'runs an unzip command and yields to a block' do
        arg = ''
        expect(subject.class).to receive(:execute).with(command)
        expect(FileUtils).to receive(:rm_rf)
        subject.class.unzip(path, output_file) { |a| arg = a }
        expect(arg).to eq('output/test_out')
      end
    end
  end

  describe '#zip' do
    let(:command) { 'zip -j -qq -r "output/test.tif" "files/test.zip"' }

    it 'runs a zip command ' do
      expect(subject.class).to receive(:execute).with(command)
      subject.class.zip(path, output_file)
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
geo_concerns-0.3.4 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.3.3 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.3.2 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.3.1 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.3.0 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.2.0 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.1.1 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.1.0 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.0.10 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.0.9 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.0.8 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.0.7 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.0.6 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.0.5 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.0.4 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.0.3 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.0.2 spec/processors/geo_concerns/processors/zip_spec.rb
geo_concerns-0.0.1 spec/processors/geo_concerns/processors/zip_spec.rb