Sha256: d9889ef00b44a953dba6039dcb41c0000aea3724ebce431365a21067f69dcd2a

Contents?: true

Size: 1.68 KB

Versions: 15

Compression:

Stored size: 1.68 KB

Contents

require 'spec_helper'
require 'aws-sdk'
require 'dpl/provider/s3'

describe DPL::Provider::S3 do
  
  before (:each) do
    AWS.stub!
  end
  
  subject :provider do
    described_class.new(DummyContext.new, :access_key_id => 'qwertyuiopasdfghjklz', :secret_access_key => 'qwertyuiopasdfghjklzqwertyuiopasdfghjklz', :bucket => 'my-bucket')
  end

  describe :check_auth do
    example do
      provider.should_receive(:setup_auth)
      provider.should_receive(:log).with("Logging in with Access Key: ****************jklz")
      provider.check_auth
    end
  end

  describe :upload_path do
    example "Without :upload_dir"do
      filename = "testfile.file"

      provider.upload_path(filename).should == "testfile.file"
    end

    example "With :upload_dir" do
      provider.options.update(:upload_dir => 'BUILD3')
      filename = "testfile.file"

      provider.upload_path(filename).should == "BUILD3/testfile.file"
    end
  end

  describe :setup_auth do
    example do
      AWS.should_receive(:config).with(:access_key_id => 'qwertyuiopasdfghjklz', :secret_access_key => 'qwertyuiopasdfghjklzqwertyuiopasdfghjklz').once.and_call_original
      provider.setup_auth
    end
  end
  
describe :needs_key? do
    example do
      provider.needs_key?.should == false
    end
  end

  describe :push_app do
    example "Without local_dir" do
      Dir.should_receive(:chdir).with(Dir.pwd)
      provider.push_app
    end

    example "With local_dir" do
      provider.options.update(:local_dir => 'BUILD')
      
      Dir.should_receive(:chdir).with('BUILD')
      provider.push_app
    end
  end

  describe :api do   
    example do
      AWS::S3.should_receive(:new)
      provider.api
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dpl-1.5.7 spec/provider/s3_spec.rb
dpl-1.5.6 spec/provider/s3_spec.rb
dpl-1.5.5 spec/provider/s3_spec.rb
dpl-1.5.5.travis.270.1 spec/provider/s3_spec.rb
dpl-1.5.4 spec/provider/s3_spec.rb
dpl-1.5.3.travis.269.1 spec/provider/s3_spec.rb
dpl-1.5.3.travis.268.1 spec/provider/s3_spec.rb
dpl-1.5.3.travis.264.1 spec/provider/s3_spec.rb
dpl-1.5.3.travis.265.1 spec/provider/s3_spec.rb
dpl-1.5.3.travis.262.1 spec/provider/s3_spec.rb
dpl-1.5.3.travis.261.1 spec/provider/s3_spec.rb
dpl-1.5.3.travis.259.1 spec/provider/s3_spec.rb
dpl-1.5.3.travis.257.1 spec/provider/s3_spec.rb
dpl-1.5.3.travis.255.2 spec/provider/s3_spec.rb
dpl-1.5.3.travis.254.2 spec/provider/s3_spec.rb