Sha256: 71b533577ac74e5b3a40a0de05b82654fc3f27d87e6c5aed5f941301b403b1cd

Contents?: true

Size: 1.03 KB

Versions: 12

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

module Vzaar
  describe Uploader do
    let(:conn) { double }
    let(:guid) { double }
    let(:key) { double }
    let(:signature) { double(guid: guid, key: key) }
    let(:path) { double }
    let(:opts) do
      { url: url, path: path }
    end

    subject { described_class.new(conn, signature, opts) }

    describe "#upload" do
      let(:uploader) { double }

      describe "standard upload directly to s3" do
        let(:url) { nil }

        specify do
          allow(Uploaders::S3).to receive(:new)
            .with(opts[:path], signature) { uploader }

          allow(uploader).to receive(:upload)
          subject.upload
        end
      end

      describe "link upload" do
        let(:url) { double }

        specify do
          expected_opts = opts.merge({ guid: guid, key: key })
          allow(Request::LinkUpload).to receive(:new)
            .with(conn, expected_opts) { uploader }

          allow(uploader).to receive(:execute)
          subject.upload
        end
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vzaar-1.5.3 spec/vzaar/uploader_spec.rb
vzaar-1.5.2 spec/vzaar/uploader_spec.rb
vzaar-1.5.1 spec/vzaar/uploader_spec.rb
vzaar-1.5.0 spec/vzaar/uploader_spec.rb
vzaar-1.4.4 spec/vzaar/uploader_spec.rb
vzaar-1.4.1 spec/vzaar/uploader_spec.rb
vzaar-1.3.1 spec/vzaar/uploader_spec.rb
vzaar-1.3.0 spec/vzaar/uploader_spec.rb
vzaar-1.2.4 spec/vzaar/uploader_spec.rb
vzaar-1.2.3 spec/vzaar/uploader_spec.rb
vzaar-1.2.2 spec/vzaar/uploader_spec.rb
vzaar-1.0.0 spec/vzaar/uploader_spec.rb