-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Don't write original if it wasn't reprocessed #1993
Changes from 3 commits
bb4e224
92dc2f8
4030cba
0572bb7
acbf258
d9bcc8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -379,6 +379,52 @@ def counter | |
end | ||
end | ||
|
||
context "An attachment that uses S3 for storage and has styles" do | ||
before do | ||
rebuild_model( | ||
(aws2_add_region).merge storage: :s3, | ||
styles: { thumb: ["90x90#", :jpg] }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align the elements of a hash literal if they span more than one line. |
||
bucket: "bucket", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align the elements of a hash literal if they span more than one line. |
||
s3_credentials: { "access_key_id" => "12345", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align the elements of a hash literal if they span more than one line. |
||
"secret_access_key" => "54321" } | ||
) | ||
|
||
@file = File.new(fixture_file("5k.png"), "rb") | ||
@dummy = Dummy.new | ||
@dummy.avatar = @file | ||
@dummy.save | ||
end | ||
|
||
context "reprocess" do | ||
before do | ||
@object = stub | ||
@dummy.avatar.stubs(:s3_object).with(:original).returns(@object) | ||
@dummy.avatar.stubs(:s3_object).with(:thumb).returns(@object) | ||
@object.stubs(defined?(::Aws) ? :get : :read).with().yields(@file.read) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not use parentheses for method calls with no arguments. |
||
@object.stubs(:exists?).with().returns(true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not use parentheses for method calls with no arguments. |
||
end | ||
|
||
it "uploads original" do | ||
@object.expects((defined?(::Aws) ? :upload_file : :write)) | ||
.with(anything, content_type: 'image/png', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Place the . on the previous line, together with the method call receiver. |
||
acl: Paperclip::Storage::S3::DEFAULT_PERMISSION).returns(true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align the elements of a hash literal if they span more than one line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align the elements of a hash literal if they span more than one line. |
||
@object.expects((defined?(::Aws) ? :upload_file : :write)) | ||
.with(anything, content_type: 'image/jpeg', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Place the . on the previous line, together with the method call receiver. |
||
acl: Paperclip::Storage::S3::DEFAULT_PERMISSION).returns(true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align the elements of a hash literal if they span more than one line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align the elements of a hash literal if they span more than one line. |
||
@dummy.avatar.reprocess! | ||
end | ||
|
||
it "doesn't upload original" do | ||
@object.expects((defined?(::Aws) ? :upload_file : :write)) | ||
.with(anything, content_type: 'image/jpeg', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Place the . on the previous line, together with the method call receiver. |
||
acl: Paperclip::Storage::S3::DEFAULT_PERMISSION).returns(true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align the elements of a hash literal if they span more than one line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align the elements of a hash literal if they span more than one line. |
||
@dummy.avatar.reprocess!(:thumb) | ||
end | ||
end | ||
|
||
after { @file.close } | ||
end | ||
|
||
context "An attachment that uses S3 for storage and has spaces in file name" do | ||
before do | ||
rebuild_model( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [85/80]