mirror of
https://github.com/discourse/discourse.git
synced 2024-12-18 21:05:58 +08:00
493d437e79
* Remove outdated option
04078317ba
* Use the non-globally exposed RSpec syntax
https://github.com/rspec/rspec-core/pull/2803
* Use the non-globally exposed RSpec syntax, cont
https://github.com/rspec/rspec-core/pull/2803
* Comply to strict predicate matchers
See:
- https://github.com/rspec/rspec-expectations/pull/1195
- https://github.com/rspec/rspec-expectations/pull/1196
- https://github.com/rspec/rspec-expectations/pull/1277
38 lines
930 B
Ruby
38 lines
930 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe Jobs::SyncAclsForUploads do
|
|
let(:upload1) { Fabricate(:upload) }
|
|
let(:upload2) { Fabricate(:upload) }
|
|
let(:upload3) { Fabricate(:secure_upload) }
|
|
let(:upload_ids) { [upload1.id, upload2.id, upload3.id] }
|
|
|
|
def run_job
|
|
described_class.new.execute(upload_ids: upload_ids)
|
|
end
|
|
|
|
it "does nothing if not using external storage" do
|
|
Upload.expects(:where).never
|
|
run_job
|
|
end
|
|
|
|
context "external storage enabled" do
|
|
before do
|
|
setup_s3
|
|
stub_s3_store
|
|
end
|
|
|
|
it "runs update_upload_ACL for each upload" do
|
|
Discourse.store.expects(:update_upload_ACL).times(3)
|
|
run_job
|
|
end
|
|
|
|
it "handles updates throwing an exception" do
|
|
Discourse.store.expects(:update_upload_ACL).raises(StandardError).then.returns(true, true).times(3)
|
|
Discourse.expects(:warn_exception).once
|
|
run_job
|
|
end
|
|
end
|
|
end
|