debian-mirror-gitlab/spec/uploaders/lfs_object_uploader_spec.rb

45 lines
1.1 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe LfsObjectUploader do
2017-09-10 17:25:29 +05:30
let(:lfs_object) { create(:lfs_object, :with_file) }
2018-03-17 18:26:18 +05:30
let(:uploader) { described_class.new(lfs_object, :file) }
2017-09-10 17:25:29 +05:30
let(:path) { Gitlab.config.lfs.storage_path }
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
subject { uploader }
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
it_behaves_like "builds correct paths",
2023-06-20 00:43:36 +05:30
store_dir: %r[\h{2}/\h{2}],
cache_dir: %r[/lfs-objects/tmp/cache],
work_dir: %r[/lfs-objects/tmp/work]
2018-05-09 12:01:36 +05:30
context "object store is REMOTE" do
before do
stub_lfs_object_storage
end
include_context 'with storage', described_class::Store::REMOTE
it_behaves_like "builds correct paths",
2023-06-20 00:43:36 +05:30
store_dir: %r[\h{2}/\h{2}]
2018-05-09 12:01:36 +05:30
end
describe 'remote file' do
let(:lfs_object) { create(:lfs_object, :object_storage, :with_file) }
context 'with object storage enabled' do
before do
stub_lfs_object_storage
end
it 'can store file remotely' do
lfs_object
expect(lfs_object.file_store).to eq(described_class::Store::REMOTE)
expect(lfs_object.file.path).not_to be_blank
end
end
end
2017-08-17 22:00:37 +05:30
end