Sha256: e21d2b613c583fb80a82129b427e7a99a72b4a75f4482cecf1439abf61e00ba6

Contents?: true

Size: 1.71 KB

Versions: 12

Compression:

Stored size: 1.71 KB

Contents

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

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

  directory_attributes = {
      :key => 'fogfilestests'
  }

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

    versions = []
    versions << @instance.connection.put_object(@instance.key, 'one', 'abcde').headers['x-amz-version-id']

    puts versions.first

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

    puts versions.first

    versions << @instance.connection.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.collect(&:version)
      end
    end

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

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

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

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

end

Version data entries

12 entries across 12 versions & 6 rubygems

Version Path
fog-1.5.0 tests/aws/models/storage/versions_tests.rb
rackspace-fog-1.4.2 tests/aws/models/storage/versions_tests.rb
fog-1.4.0 tests/aws/models/storage/versions_tests.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/tests/aws/models/storage/versions_tests.rb
michiels-fog-1.3.1 tests/aws/models/storage/versions_tests.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/tests/aws/models/storage/versions_tests.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/tests/aws/models/storage/versions_tests.rb
fog-1.3.1 tests/aws/models/storage/versions_tests.rb
fog-1.3.0 tests/aws/models/storage/versions_tests.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/tests/aws/models/storage/versions_tests.rb
fog-1.2.0 tests/aws/models/storage/versions_tests.rb
ktheory-fog-1.1.2 tests/aws/models/storage/versions_tests.rb