Sha256: f99f57f6287ee546f898a7990051032c0213d6ebaa3b1a6c59a378527743f857

Contents?: true

Size: 1.75 KB

Versions: 12

Compression:

Stored size: 1.75 KB

Contents

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

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

  directory_attributes = {
      :key => 'fogfilestests'
  }

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

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

    v1 = @instance.version
    v2 = @directory.connection.put_object(@directory.key, @instance.key, 'version 2 content').headers['x-amz-version-id']
    v3 = @directory.connection.delete_object(@directory.key, @instance.key).headers['x-amz-version-id']
    v4 = @directory.connection.put_object(@directory.key, @instance.key, 'version 3 content').headers['x-amz-version-id']

    tests("#get") do
      tests("#get without version fetches the latest version").returns(v4) do
        @directory.files.get(@instance.key).version
      end

      tests("#get with version fetches that exact version").returns(v2) do
        @directory.files.get(@instance.key, 'versionId' => v2).version
      end

      tests("#get with a deleted version returns nil").returns(nil) do
        @directory.files.get(@instance.key, 'versionId' => v3)
      end
    end

    tests("#head") do
      tests("#head without version fetches the latest version").returns(v4) do
        @directory.files.head(@instance.key).version
      end

      tests("#head with version fetches that exact version").returns(v2) do
        @directory.files.head(@instance.key, 'versionId' => v2).version
      end

      tests("#head with a deleted version returns nil").returns(nil) do
        @directory.files.head(@instance.key, 'versionId' => v3)
      end
    end

  end

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

end

Version data entries

12 entries across 12 versions & 6 rubygems

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