mirror of
https://github.com/discourse/discourse.git
synced 2026-08-13 14:35:08 -05:00
DEV: Convert the downsizing script to a rake task (#18976)
…to make it testable!
This commit is contained in:
@@ -216,4 +216,24 @@ RSpec.describe "tasks/uploads" do
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "uploads:downsize" do
|
||||
def invoke_task
|
||||
capture_stdout do
|
||||
Rake::Task["uploads:downsize"].invoke
|
||||
end
|
||||
end
|
||||
|
||||
before do
|
||||
STDIN.stubs(:beep)
|
||||
end
|
||||
|
||||
fab!(:upload) { Fabricate(:image_upload, width: 200, height: 200) }
|
||||
|
||||
it "corrects upload attributes" do
|
||||
upload.update!(thumbnail_height: 0)
|
||||
|
||||
expect { invoke_task }.to change { upload.reload.thumbnail_height }.to(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user