test/integration_test.rb in thoughtbot-paperclip-2.2.0 vs test/integration_test.rb in thoughtbot-paperclip-2.2.1
- old
+ new
@@ -49,9 +49,26 @@
assert_match /\b150x25\b/, `identify "#{@dummy.avatar.path(:thumb)}"`
end
end
end
+ context "A model that modifies its original" do
+ setup do
+ rebuild_model :styles => { :original => "2x2#" }
+ @dummy = Dummy.new
+ @file = File.new(File.join(File.dirname(__FILE__),
+ "fixtures",
+ "5k.png"), 'rb')
+ @dummy.avatar = @file
+ end
+
+ should "report the file size of the processed file and not the original" do
+ assert_not_equal @file.size, @dummy.avatar.size
+ end
+
+ teardown { @file.close }
+ end
+
context "A model with attachments scoped under an id" do
setup do
rebuild_model :styles => { :large => "100x100",
:medium => "50x50" },
:path => ":rails_root/tmp/:id/:attachments/:style.:extension"