Skip to content
Snippets Groups Projects
Commit 38b55f33 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre Committed by GitLab Release Tools Bot
Browse files

Fix Geo checksummable check failing when file is nil

parent b7cbf0c1
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment