Sha256: 5bedb814df3e8f216dc886cacbfad6239093600bb1cd7b82bf9779329e206e03

Contents?: true

Size: 1.93 KB

Versions: 29

Compression:

Stored size: 1.93 KB

Contents

Shindo.tests("Storage[:aws] | file", ["aws"]) do

  require 'tempfile'

  file_attributes = {
    :key => 'fog_file_tests',
    :body => lorem_file,
    :public => true
  }

  directory_attributes = {
    :key => uniq_id("fogfilestests")
  }

  @directory = Fog::Storage[:aws].directories.create(directory_attributes)

  model_tests(@directory.files, file_attributes, Fog.mocking?) do

    tests("#version") do
      tests("#version should be null if versioning isn't enabled").returns(nil) do
        @instance.version
      end
    end

  end

  @directory.versioning = true

  model_tests(@directory.files, file_attributes, Fog.mocking?) do

    tests("#version") do
      tests("#version should not be null if versioning is enabled").returns(false) do
        @instance.version == nil
      end
    end


    @directory.files.create(:key => @instance.key)
    @instance.destroy

    tests("#versions") do
      tests('#versions.size includes versions (including DeleteMarkers) for all keys').returns(3) do
        @instance.versions.size
      end

      tests('#versions are all for the correct key').returns(true) do
        @instance.versions.all? { |v| v.key == @instance.key }
      end
    end

    tests("#destroy") do
      tests("#destroy a specific version should delete the version, not create a DeleteMarker").returns(2) do
        @instance.destroy('versionId' => @instance.version)
        @instance.versions.all.size
      end
    end

    tests("multipart upload") do
      pending if Fog.mocking?

      # A 6MB file
      @large_file = Tempfile.new("fog-test-aws-s3-multipart")
      6.times { @large_file.write("x" * (1024**2)) }
      @large_file.rewind

      tests("#save(:multipart_chunk_size => 5242880)").succeeds do
        @directory.files.create(:key => 'multipart-upload', :body => @large_file, :multipart_chunk_size => 5242880)
      end

      @large_file.close

    end

  end

  @directory.versions.each(&:destroy)
  @directory.destroy

end

Version data entries

29 entries across 29 versions & 3 rubygems

Version Path
fog-maestrodev-1.18.0.20131125111730 tests/aws/models/storage/file_tests.rb
fog-maestrodev-1.18.0.20131125083406 tests/aws/models/storage/file_tests.rb
fog-maestrodev-1.18.0.20131123105121 tests/aws/models/storage/file_tests.rb
fog-maestrodev-1.18.0.20131122203507 tests/aws/models/storage/file_tests.rb
fog-maestrodev-1.18.0.20131121075022 tests/aws/models/storage/file_tests.rb
fog-maestrodev-1.18.0.20131118164830 tests/aws/models/storage/file_tests.rb
fog-maestrodev-1.18.0.20131115184302 tests/aws/models/storage/file_tests.rb
fog-maestrodev-1.18.0.20131114200144 tests/aws/models/storage/file_tests.rb
gapinc-fog-1.12.1.2.1 tests/aws/models/storage/file_tests.rb
fog-maestrodev-1.18.0.20131112185232 tests/aws/models/storage/file_tests.rb
fog-maestrodev-1.18.0.20131111203459 tests/aws/models/storage/file_tests.rb
fog-1.18.0 tests/aws/models/storage/file_tests.rb
fog-1.17.0 tests/aws/models/storage/file_tests.rb
fog-1.16.0 tests/aws/models/storage/file_tests.rb
fog-maestrodev-1.15.0.20130927082724 tests/aws/models/storage/file_tests.rb
fog-maestrodev-1.15.0.20130829165835 tests/aws/models/storage/file_tests.rb
fog-1.15.0 tests/aws/models/storage/file_tests.rb
gapinc-fog-1.14.0 tests/aws/models/storage/file_tests.rb
fog-maestrodev-1.14.0.20130806165225 tests/aws/models/storage/file_tests.rb
fog-1.14.0 tests/aws/models/storage/file_tests.rb