Permalink
Browse files

Integration test for content type

  • Loading branch information...
1 parent aebbb7c commit 5751624c7f18396fbb8d81cab167544ff3283fb8 @jyurek jyurek committed Nov 14, 2008
Showing with 14 additions and 0 deletions.
  1. +14 −0 test/integration_test.rb
View
@@ -274,6 +274,14 @@ def s3_files_for attachment
end
end
+ def s3_headers_for attachment, style
+ `curl --head '#{attachment.url(style)}' 2>/dev/null`.split("\n").inject({}) do |h,head|
+ split_head = head.chomp.split(/\s*:\s*/, 2)
+ h[split_head.first.downcase] = split_head.last unless split_head.empty?
+ h
+ end
+ end
+
context "A model with an S3 attachment" do
setup do
rebuild_model :styles => { :large => "300x300>",
@@ -387,6 +395,12 @@ def s3_files_for attachment
@dummy.reload
assert_equal "5k.png", @dummy.avatar_file_name
end
+
+ should "have the right content type" do
+ headers = s3_headers_for(@dummy.avatar, :original)
+ p headers
+ assert_equal 'image/png', headers['content-type']
+ end
end
end
end

0 comments on commit 5751624

Please sign in to comment.