Commit afc8f4bc by Jon Berke Committed by Jon Yurek

Adds integration test for style-specific s3 headers and metadata

parent adabe469
...@@ -532,7 +532,13 @@ class IntegrationTest < Test::Unit::TestCase ...@@ -532,7 +532,13 @@ class IntegrationTest < Test::Unit::TestCase
setup do setup do
rebuild_model :styles => { :large => "300x300>", rebuild_model :styles => { :large => "300x300>",
:medium => "100x100", :medium => "100x100",
:thumb => ["32x32#", :gif] }, :thumb => ["32x32#", :gif],
:custom => {
:geometry => "32x32#",
:s3_headers => { 'Cache-Control' => 'max-age=31557600' },
:s3_metadata => { 'foo' => 'bar'}
}
},
:storage => :s3, :storage => :s3,
:s3_credentials => File.new(fixture_file('s3.yml')), :s3_credentials => File.new(fixture_file('s3.yml')),
:s3_options => { :logger => Paperclip.logger }, :s3_options => { :logger => Paperclip.logger },
...@@ -659,6 +665,16 @@ class IntegrationTest < Test::Unit::TestCase ...@@ -659,6 +665,16 @@ class IntegrationTest < Test::Unit::TestCase
assert_equal 'image/png', headers['content-type'] assert_equal 'image/png', headers['content-type']
end end
should "have the right style-specific headers" do
headers = s3_headers_for(@dummy.avatar, :custom)
assert_equal 'max-age=31557600', headers['cache-control']
end
should "have the right style-specific metadata" do
headers = s3_headers_for(@dummy.avatar, :custom)
assert_equal 'bar', headers['x-amz-meta-foo']
end
context "with non-english character in the file name" do context "with non-english character in the file name" do
setup do setup do
@file.stubs(:original_filename).returns("クリップ.png") @file.stubs(:original_filename).returns("クリップ.png")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment