Commit 6486bca9 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'cat-fix-blob-file-exists-check' into 'master'

Fix Geo checksummable check failing when file is nil

See merge request gitlab-org/gitlab!80280
parents dc04eea3 89675a1a
......@@ -95,7 +95,7 @@ module Geo
#
# @return [Boolean] whether the file exists on disk or in remote storage
def file_exists?
carrierwave_uploader.file.exists?
carrierwave_uploader.file&.exists?
end
def deleted_params
......
......@@ -231,4 +231,29 @@ RSpec.shared_examples 'a blob replicator' do
end
end
end
describe '#file_exists?' do
let(:file) { double(exists?: true) }
let(:uploader) { double(file: file) }
subject { replicator.file_exists? }
before do
allow(replicator).to receive(:carrierwave_uploader).and_return(uploader)
end
it { is_expected.to be_truthy }
context 'when the file does not exist' do
let(:file) { double(exists?: false) }
it { is_expected.to be_falsey }
end
context 'when the file is nil' do
let(:file) { nil }
it { is_expected.to be_falsey }
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment