Sha256: b867ae6359a1e919234d6d711b8c0ac010419c94df44840883e0acdd292e655a

Contents?: true

Size: 1.1 KB

Versions: 27

Compression:

Stored size: 1.1 KB

Contents

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

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

    before(:each) do
      s3.put_bucket('fogputobject')
      file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
      @response = s3.put_object('fogputobject', 'fog_put_object', 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
      file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
      actual = s3.put_object('fogputobject', 'fog_put_object', file)
      actual.status.should == 200
    end

  end
  describe 'failure' do

    it 'should raise a NotFound error if the bucket does not exist' do
      lambda {
        file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
        s3.put_object('fognotabucket', 'fog_put_object', file)
      }.should raise_error(Fog::Errors::NotFound)
    end

  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
fog-0.0.29 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.28 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.27 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.26 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.25 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.24 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.23 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.22 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.21 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.20 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.19 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.18 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.17 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.16 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.15 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.14 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.13 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.12 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.11 spec/aws/requests/s3/put_object_spec.rb
fog-0.0.10 spec/aws/requests/s3/put_object_spec.rb