2016-08-18 10:31:44 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe AttachmentUploader do
|
2017-02-23 16:54:25 -05:00
|
|
|
let(:uploader) { described_class.new(build_stubbed(:user)) }
|
2016-08-18 10:31:44 -04:00
|
|
|
|
2017-06-07 23:32:38 -04:00
|
|
|
describe "#store_dir" do
|
|
|
|
it "stores in the system dir" do
|
2017-07-17 09:46:59 -04:00
|
|
|
expect(uploader.store_dir).to start_with("uploads/-/system/user")
|
2017-06-07 23:32:38 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "uses the old path when using object storage" do
|
|
|
|
expect(described_class).to receive(:file_storage?).and_return(false)
|
|
|
|
expect(uploader.store_dir).to start_with("uploads/user")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-08-18 10:31:44 -04:00
|
|
|
describe '#move_to_cache' do
|
|
|
|
it 'is true' do
|
2017-02-23 16:54:25 -05:00
|
|
|
expect(uploader.move_to_cache).to eq(true)
|
2016-08-18 10:31:44 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#move_to_store' do
|
|
|
|
it 'is true' do
|
2017-02-23 16:54:25 -05:00
|
|
|
expect(uploader.move_to_store).to eq(true)
|
2016-08-18 10:31:44 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|