Sha256: 4e8270e28abe482a631b732a34baf26d48762fdf6b9890c3928e2f254487a894

Contents?: true

Size: 822 Bytes

Versions: 9

Compression:

Stored size: 822 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe Lcms::Engine::S3Service do
  describe '.upload' do
    let(:data) { StringIO.new('data to be uploaded') }
    let(:full_options) { options.merge(body: data) }
    let(:key) { 'path/to/file' }
    let(:object) do
      params = {
        put: 'true',
        public_url: url
      }
      double(::Aws::S3::Resource, **params)
    end
    let(:options) { { content_type: 'image/png' } }
    let(:url) { Faker::Internet.url }

    before { allow(described_class).to receive(:create_object).with(key).and_return(object) }

    subject { described_class.upload(key, data, options) }

    it 'uploads data with passed params' do
      expect(object).to receive(:put).with(full_options)
      subject
    end

    it 'returns URL of the uploaded object'
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lcms-engine-0.5.5 spec/services/s3_service_spec.rb
lcms-engine-0.5.4 spec/services/s3_service_spec.rb
lcms-engine-0.5.3 spec/services/s3_service_spec.rb
lcms-engine-0.5.2 spec/services/s3_service_spec.rb
lcms-engine-0.5.1 spec/services/s3_service_spec.rb
lcms-engine-0.5.0 spec/services/s3_service_spec.rb
lcms-engine-0.4.2 spec/services/s3_service_spec.rb
lcms-engine-0.4.1 spec/services/s3_service_spec.rb
lcms-engine-0.4.0 spec/services/s3_service_spec.rb