Sha256: 802405d735d5c02f07f4211a228c8a4d359213cc1c826e4ca9a31a4cbc35d920

Contents?: true

Size: 1.22 KB

Versions: 9

Compression:

Stored size: 1.22 KB

Contents

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

describe 'S3.put_object' do
  describe 'success' do

    before(:each) do
      s3.put_bucket('fogputobject')
      @response = s3.put_object('fogputobject', 'fog_put_object', lorem_file)
    end

    after(:each) do
      s3.delete_object('fogputobject', 'fog_put_object')
      s3.delete_bucket('fogputobject')
    end

    it 'should return proper attributes' do
      @response.status.should == 200
    end

    it 'should not raise an error if the object already exists' do
      actual = s3.put_object('fogputobject', 'fog_put_object', lorem_file)
      actual.status.should == 200
    end

  end
  describe 'failure' do

    it 'should raise a NotFound error if the bucket does not exist' do
      lambda {
        s3.put_object('fognotabucket', 'fog_put_object', lorem_file)
      }.should raise_error(Excon::Errors::NotFound)
    end

    it 'should not raise an error if the object already exists' do
      s3.put_bucket('fogputobject')
      s3.put_object('fogputobject', 'fog_put_object', lorem_file)
      s3.put_object('fogputobject', 'fog_put_object', lorem_file)
      s3.delete_object('fogputobject', 'fog_put_object')
      s3.delete_bucket('fogputobject')
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fog-0.0.40 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.39 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.38 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.37 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.36 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.35 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.34 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.33 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.32 spec/aws/requests/s3/put_object_spec.rb