Sha256: e5979e29c6177ea18aa2ae5670be1d6a6d8354978ae369403c4bc285d8feb825

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

require File.dirname(__FILE__) + '/../../../spec_helper'

describe 'S3.get_bucket' do

  before(:all) do
    @s3 = Fog::AWS::S3.gen
    @s3.put_bucket('foggetbucket')
    file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
    @s3.put_object('foggetbucket', 'fog_get_bucket', file)
  end

  after(:all) do
    @s3.delete_object('foggetbucket', 'fog_get_bucket')
    @s3.delete_bucket('foggetbucket')
  end

  it 'should return proper attributes' do
    actual = @s3.get_bucket('foggetbucket')
    actual.body['IsTruncated'].should == false
    actual.body['Marker'].should be_a(String)
    actual.body['MaxKeys'].should be_an(Integer)
    actual.body['Name'].should be_a(String)
    actual.body['Prefix'].should be_a(String)
    actual.body['Contents'].should be_an(Array)
    object = actual.body['Contents'].first
    object['ETag'].should be_a(String)
    object['Key'].should == 'fog_get_bucket'
    object['LastModified'].should be_a(Time)
    owner = object['Owner']
    owner['DisplayName'].should be_a(String)
    owner['ID'].should be_a(String)
    object['Size'].should be_an(Integer)
    object['StorageClass'].should be_a(String)
  end

  it 'should raise a NotFound error if the bucket does not exist' do
    lambda {
      @s3.get_bucket('fognotabucket')
    }.should raise_error(Fog::Errors::NotFound)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
geemus-fog-0.0.1 spec/aws/requests/s3/get_bucket_spec.rb
geemus-fog-0.0.3 spec/aws/requests/s3/get_bucket_spec.rb