0

I can't seem to reproduce a file copy in a testing environment. I'm trying to test that I can set the content type of a Fog AWS S3 file, but it looks like the file isn't changing when I try to update it. It works when not mocking.

Fog.mock!

file = fog_dir.files.create(:key => "image.png", :public => true)

options = {
  'Content-Type' => "image/png",
  'x-amz-metadata-directive' => 'REPLACE'
}
file.copy file.directory.key, file.key, options

# Failing
fog_dir.files.head(file_name).content_type.should eql "image/png"
mscriven
  • 409
  • 4
  • 10

1 Answers1

2

Looking at the source for the copy_file mock, it looks like this is indeed a bug in the Fog mocks as of 1.20.0; notice how it .dups the source object, but doesn't take anything out of the options hash into account other than x-amz-acl.

This is probably worth filing a fog issue!

Ash Wilson
  • 22,820
  • 3
  • 34
  • 45