Sha256: cfed2759077b167a751533b046887f173445a2dd22128071cc6250257fab5f49

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 Bytes

Contents

require 'spec_helper'
require 'uri'

describe GeoConcerns::DeliveryJob do
  let(:file_set) { double(FileSet, id: 'abc123') }

  context '#perform' do
    context 'local file' do
      let(:content_url) { 'file:/somewhere-to-display-copy' }
      it 'delegates to DeliveryService' do
        dbl = double
        expect(GeoConcerns::DeliveryService).to receive(:new).and_return(dbl)
        expect(dbl).to receive(:publish).with(file_set.id, URI(content_url).path)
        subject.perform(file_set, content_url)
      end
    end
    context 'remote file' do
      let(:content_url) { 'http://somewhere/to-display-copy' }
      it 'errors out' do
        expect(GeoConcerns::DeliveryService).not_to receive(:new)
        expect { subject.perform(file_set, content_url) }.to raise_error(NotImplementedError, /Only supports file URLs/)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geo_concerns-0.0.8 spec/jobs/delivery_job_spec.rb