Sha256: 4c8a9c41bbbb4072295d978cbc1f498b2c52315fe9a820c8738257773591b730

Contents?: true

Size: 1.64 KB

Versions: 25

Compression:

Stored size: 1.64 KB

Contents

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

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

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

  model_tests(Fog::Storage[:aws].directories, directory_attributes, Fog.mocking?) do
    @instance.versioning = true

    versions = []
    versions << @instance.service.put_object(@instance.key, 'one', 'abcde').headers['x-amz-version-id']
    versions << @instance.service.put_object(@instance.key, 'one', '32423').headers['x-amz-version-id']
    versions << @instance.service.delete_object(@instance.key, 'one').headers['x-amz-version-id']
    versions.reverse!

    versions << @instance.service.put_object(@instance.key, 'two', 'aoeu').headers['x-amz-version-id']

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

      tests('#versions returns the correct versions').returns(versions) do
        @instance.versions.all.map(&:version)
      end
    end

    tests("#all") do
      tests("#all for a directory returns all versions, regardless of key").returns(versions) do
        @instance.versions.all.map(&:version)
      end

      tests("#all for file returns only versions for that file").returns(1) do
        @instance.files.get('two').versions.all.map(&:version).size
      end

      tests("#all for file returns only versions for that file").returns(versions.last) do
        @instance.files.get('two').versions.all.map(&:version).first
      end
    end

    @instance.versions.each(&:destroy)
  end

end

Version data entries

25 entries across 23 versions & 2 rubygems

Version Path
fog-aws-3.12.0 tests/models/storage/versions_tests.rb
fog-aws-3.11.0 tests/models/storage/versions_tests.rb
fog-aws-3.10.0 tests/models/storage/versions_tests.rb
fog-aws-3.9.0 tests/models/storage/versions_tests.rb
fog-aws-3.8.0 tests/models/storage/versions_tests.rb
fog-aws-3.7.0 tests/models/storage/versions_tests.rb
fog-aws-3.6.7 tests/models/storage/versions_tests.rb
fog-aws-3.6.6 tests/models/storage/versions_tests.rb
fog-aws-3.6.5 tests/models/storage/versions_tests.rb
fog-aws-3.6.4 tests/models/storage/versions_tests.rb
fog-aws-3.6.3 tests/models/storage/versions_tests.rb
fog-aws-3.6.2 tests/models/storage/versions_tests.rb
fog-aws-3.5.2 tests/models/storage/versions_tests.rb
fog-aws-3.5.1 tests/models/storage/versions_tests.rb
fog-aws-3.5.0 tests/models/storage/versions_tests.rb
fog-aws-3.4.0 tests/models/storage/versions_tests.rb
fog-aws-3.3.0 tests/models/storage/versions_tests.rb
fog-aws-3.2.0 tests/models/storage/versions_tests.rb
fog-aws-3.1.0 tests/models/storage/versions_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aws-2.0.1/tests/models/storage/versions_tests.rb