Sha256: 54dc725f1883c2712a3ada94cd1bacd88734f843edaeb326f4d6329f9c7e39fb

Contents?: true

Size: 1013 Bytes

Versions: 13

Compression:

Stored size: 1013 Bytes

Contents

require 'spec_helper'

describe DownloadsController, type: :controller do
  let(:user) { FactoryGirl.create(:user) }

  subject { described_class.new }

  before(:each) do
    allow(subject).to receive(:params).and_return(params)
  end

  describe '#load_file' do
    context 'with a default file' do
      let(:params) { {} }

      it 'returns default file' do
        expect(subject).to receive(:default_file).and_return('path')
        expect(subject.load_file).to eq('path')
      end
    end

    context 'with a thumbnail file' do
      let(:params) { { file: 'thumbnail' } }
      let(:asset) { double }
      before do
        allow(subject).to receive(:asset).and_return(asset)
        allow(File).to receive(:exist?).and_return(true)
      end

      it 'calls GeoConcerns::DerivativePath and returns the thumb path' do
        expect(GeoConcerns::DerivativePath).to receive(:derivative_path_for_reference).and_return('path')
        expect(subject.load_file).to eq('path')
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
geo_concerns-0.3.4 spec/controllers/downloads_controller_spec.rb
geo_concerns-0.3.3 spec/controllers/downloads_controller_spec.rb
geo_concerns-0.3.2 spec/controllers/downloads_controller_spec.rb
geo_concerns-0.3.1 spec/controllers/downloads_controller_spec.rb
geo_concerns-0.3.0 spec/controllers/downloads_controller_spec.rb
geo_concerns-0.2.0 spec/controllers/downloads_controller_spec.rb
geo_concerns-0.1.1 spec/controllers/downloads_controller_spec.rb
geo_concerns-0.1.0 spec/controllers/downloads_controller_spec.rb
geo_concerns-0.0.10 spec/controllers/downloads_controller_spec.rb
geo_concerns-0.0.9 spec/controllers/downloads_controller_spec.rb
geo_concerns-0.0.8 spec/controllers/downloads_controller_spec.rb
geo_concerns-0.0.7 spec/controllers/downloads_controller_spec.rb
geo_concerns-0.0.6 spec/controllers/downloads_controller_spec.rb