blob: 2121e9cbc29afc3eed14333969b10532ae01f5e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe ExternalDiffUploader do
let(:diff) { create(:merge_request).merge_request_diff }
let(:path) { Gitlab.config.external_diffs.storage_path }
subject(:uploader) { described_class.new(diff, :external_diff) }
it_behaves_like "builds correct paths",
store_dir: %r[merge_request_diffs/mr-\d+],
cache_dir: %r[/external-diffs/tmp/cache],
work_dir: %r[/external-diffs/tmp/work]
context "object store is REMOTE" do
before do
stub_external_diffs_object_storage
end
include_context 'with storage', described_class::Store::REMOTE
it_behaves_like "builds correct paths",
store_dir: %r[merge_request_diffs/mr-\d+]
end
describe 'remote file' do
context 'with object storage enabled' do
before do
stub_external_diffs_setting(enabled: true)
stub_external_diffs_object_storage
diff.update!(external_diff_store: described_class::Store::REMOTE)
end
it 'can store file remotely' do
diff
expect(diff.external_diff_store).to eq(described_class::Store::REMOTE)
expect(diff.external_diff.path).not_to be_blank
end
end
end
end
|