Sha256: eb614d95ad3dc0cf7ab1ec7701778989cbcb96b98347c1fb3781ccdc69703a12

Contents?: true

Size: 1.86 KB

Versions: 11

Compression:

Stored size: 1.86 KB

Contents

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

describe 'S3.copy_object' do
  describe 'success' do

    before(:each) do
      s3.put_bucket('fogcopyobjectsource')
      s3.put_object('fogcopyobjectsource', 'fog_copy_object_source', lorem_file)
      s3.put_bucket('fogcopyobjectdestination')
    end

    after(:each) do
      s3.delete_object('fogcopyobjectdestination', 'fog_copy_object_destination')
      s3.delete_bucket('fogcopyobjectdestination')
      s3.delete_object('fogcopyobjectsource', 'fog_copy_object_source')
      s3.delete_bucket('fogcopyobjectsource')
    end

    it 'should return proper attributes' do
      actual = s3.copy_object(
        'fogcopyobjectsource', 'fog_copy_object_source',
        'fogcopyobjectdestination', 'fog_copy_object_destination'
      )
      actual.status.should == 200
      actual.body['ETag'].should be_a(String)
      actual.body['LastModified'].should be_a(Time)
    end

  end
  describe 'failure' do

    it 'should raise a NotFound error if the source_bucket does not exist' do
      lambda {
        s3.copy_object(
          'fognotabucket', 'fog_copy_object_source',
          'fogcopyobjectdestination', 'fog_copy_object_destination'
        )
      }.should raise_error(Excon::Errors::NotFound)
    end

    it 'should raise a NotFound error if the source_object does not exist' do
      lambda {
        s3.copy_object(
          'fogcopyobjectsource', 'fog_not_an_object',
          'fogcopyobjectdestination', 'fog_copy_object_destination'
        )
      }.should raise_error(Excon::Errors::NotFound)
    end

    it 'should raise a NotFound error if the target_bucket does not exist' do
      lambda {
        s3.copy_object(
          'fogcopyobjectsource', 'fog_copy_object_source',
          'fognotabucket', 'fog_copy_object_destination'
        )
      }.should raise_error(Excon::Errors::NotFound)
    end

  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

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