BigW Consortium Gitlab

attachment_uploader_spec.rb 705 Bytes
Newer Older
1 2 3
require 'spec_helper'

describe AttachmentUploader do
4
  let(:uploader) { described_class.new(build_stubbed(:user)) }
5

6 7
  describe "#store_dir" do
    it "stores in the system dir" do
8
      expect(uploader.store_dir).to start_with("uploads/-/system/user")
9 10 11 12 13 14 15 16
    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

17 18
  describe '#move_to_cache' do
    it 'is true' do
19
      expect(uploader.move_to_cache).to eq(true)
20 21 22 23 24
    end
  end

  describe '#move_to_store' do
    it 'is true' do
25
      expect(uploader.move_to_store).to eq(true)
26 27 28
    end
  end
end