Sha256: 48fa57dd65e0a48d92dbac2497af6d91106b692febc0bd70bc61faab7acc7469

Contents?: true

Size: 1.47 KB

Versions: 26

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'

describe Heirloom do

  before do
    @config_mock = double 'config'
    @logger_mock = double 'logger'
    @config_mock.should_receive(:logger).and_return(@logger_mock)
    @uploader = Heirloom::Uploader.new :config => @config_mock,
                                       :name   => 'tim',
                                       :id     => '123'
  end

  it "should upload a new archive" do
    s3_mock = mock 's3'
    Heirloom::Uploader::S3.should_receive(:new).
                           with(:config => @config_mock,
                                :logger => @logger_mock,
                                :region => 'us-west-1').
                           and_return s3_mock
    s3_mock.should_receive(:upload_file).
            with(:bucket          => 'prefix-us-west-1',
                 :file            => '/tmp/file',
                 :id              => '123',
                 :key_folder      => 'tim',
                 :key_name        => "123.tar.gz",
                 :name            => 'tim',
                 :public_readable => true)
    s3_mock.should_receive(:add_endpoint_attributes).
            with(:bucket => 'prefix-us-west-1',
                 :id     => '123',
                 :name   => 'tim')
    @logger_mock.should_receive(:info)
    @uploader.upload :file            => '/tmp/file',
                     :bucket_prefix   => 'prefix',
                     :regions         => ['us-west-1'],
                     :public_readable => true
  end

end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
heirloom-0.9.0 spec/archive/uploader_spec.rb
heirloom-0.8.3 spec/archive/uploader_spec.rb
heirloom-0.8.2 spec/archive/uploader_spec.rb
heirloom-0.8.1 spec/archive/uploader_spec.rb
heirloom-0.8.0 spec/archive/uploader_spec.rb
heirloom-0.7.4 spec/archive/uploader_spec.rb
heirloom-0.7.3 spec/archive/uploader_spec.rb
heirloom-0.7.3rc2 spec/archive/uploader_spec.rb
heirloom-0.7.3rc1 spec/archive/uploader_spec.rb
heirloom-0.7.2 spec/archive/uploader_spec.rb
heirloom-0.7.2rc2 spec/archive/uploader_spec.rb
heirloom-0.7.2rc1 spec/archive/uploader_spec.rb
heirloom-0.7.1 spec/archive/uploader_spec.rb
heirloom-0.7.0 spec/archive/uploader_spec.rb
heirloom-0.7.0rc1 spec/archive/uploader_spec.rb
heirloom-0.6.1 spec/archive/uploader_spec.rb
heirloom-0.6.0rc1 spec/archive/uploader_spec.rb
heirloom-0.5.0rc4 spec/archive/uploader_spec.rb
heirloom-0.5.0rc3 spec/archive/uploader_spec.rb
heirloom-0.5.0rc2 spec/archive/uploader_spec.rb