Sha256: 35cf3f3663697b6c038c30c683cb83b878d500b40edc828c20d7db6b0d90dd9c

Contents?: true

Size: 1.42 KB

Versions: 14

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'

describe Heirloom do
  before do
    @config_mock = double 'config'
    @logger_stub = stub 'logger', :info => true, :debug => true
    @config_mock.stub :logger => @logger_stub

    @s3 = Heirloom::ACL::S3.new :config  => @config_mock,
                                :region  => 'us-west-1'
  end

  it "should allow read access for the specified accounts" do
    acls = { 
              'Owner' => {
               'Name' => 'Brett',
               'ID' => '123'
              }
           }
    s3_mock = mock 's3'

    @s3.should_receive(:s3).exactly(2).times.
                            and_return(s3_mock)

    s3_mock.should_receive(:get_bucket_acl).with('bucket').
                                            and_return acls

    s3_mock.should_receive(:put_object_acl).
            with("bucket", "key-folder/key.tar.gz", {"Owner"=>{"DisplayName"=>"Brett", "ID"=>"123"}, "AccessControlList"=>[{"Grantee"=>{"EmailAddress"=>"acct1@test.com"}, "Permission"=>"READ"}, {"Grantee"=>{"EmailAddress"=>"acct2@test.com"}, "Permission"=>"READ"}, {"Grantee"=>{"DisplayName"=>"Brett", "ID"=>"123"}, "Permission"=>"FULL_CONTROL"}]})

    @s3.allow_read_access_from_accounts :bucket     => 'bucket', 
                                        :key_name   => 'key',
                                        :key_folder => 'key-folder',
                                        :accounts   => ['acct1@test.com', 'acct2@test.com']
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
heirloom-0.9.0 spec/acl/s3_spec.rb
heirloom-0.8.3 spec/acl/s3_spec.rb
heirloom-0.8.2 spec/acl/s3_spec.rb
heirloom-0.8.1 spec/acl/s3_spec.rb
heirloom-0.8.0 spec/acl/s3_spec.rb
heirloom-0.7.4 spec/acl/s3_spec.rb
heirloom-0.7.3 spec/acl/s3_spec.rb
heirloom-0.7.3rc2 spec/acl/s3_spec.rb
heirloom-0.7.3rc1 spec/acl/s3_spec.rb
heirloom-0.7.2 spec/acl/s3_spec.rb
heirloom-0.7.2rc2 spec/acl/s3_spec.rb
heirloom-0.7.2rc1 spec/acl/s3_spec.rb
heirloom-0.7.1 spec/acl/s3_spec.rb
heirloom-0.7.0 spec/acl/s3_spec.rb