Sha256: 889f6d45ca3b856ad2c2a2890053a5e5ba18ccf58de4828da3484aa07f7cb920

Contents?: true

Size: 1.6 KB

Versions: 10

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'

describe Heirloom do
  before do
    @config_mock = mock 'config'
    @config_mock.should_receive(:access_key).and_return 'the-key'
    @config_mock.should_receive(:secret_key).and_return 'the-secret'
    @fog_mock = mock 'fog'
    Fog::Storage.should_receive(:new).and_return @fog_mock
    @s3 = Heirloom::AWS::S3.new :config => @config_mock,
                                :region => 'us-west-1'


  end

  it "should delete an object from s3" do
    @fog_mock.should_receive(:delete_object).
              with('bucket', 'object', { :option => 'test' })
    @s3.delete_object('bucket', 'object', { :option => 'test' })
  end

  it "should get a bucket from s3" do
    directories_mock = mock 'directories'
    @fog_mock.should_receive(:directories).
              and_return directories_mock
    directories_mock.should_receive(:get).with 'bucket'
    @s3.get_bucket 'bucket'
  end

  it "should get an object from s3" do
    body_mock = mock 'body'
    @fog_mock.should_receive(:get_object).
              with('bucket', 'object').
              and_return body_mock
    body_mock.should_receive(:body)
    @s3.get_object('bucket', 'object')
  end

  it "should get a buckets acl from s3" do
    body_mock = mock 'body'
    @fog_mock.should_receive(:get_object).
              with('bucket', 'object').
              and_return body_mock
    body_mock.should_receive(:body)
    @s3.get_object('bucket', 'object')
  end

  it "should set object acls" do
    @fog_mock.should_receive(:put_object_acl).
              with 'bucket', 'object', 'grants'
    @s3.put_object_acl 'bucket', 'object', 'grants'
  end


end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
heirloom-0.5.0rc3 spec/aws/s3_spec.rb
heirloom-0.5.0rc2 spec/aws/s3_spec.rb
heirloom-0.5.0rc1 spec/aws/s3_spec.rb
heirloom-0.4.1rc1 spec/aws/s3_spec.rb
heirloom-0.4.0 spec/aws/s3_spec.rb
heirloom-0.3.1 spec/aws/s3_spec.rb
heirloom-0.3.0 spec/aws/s3_spec.rb
heirloom-0.3.0.rc1 spec/aws/s3_spec.rb
heirloom-0.2.0 spec/aws/s3_spec.rb
heirloom-0.1.4 spec/aws/s3_spec.rb