Fix commentaire file_url generator

This commit is contained in:
Paul Chavard 2018-10-31 12:50:48 +01:00
parent ab98e024c3
commit 8ff45c7978
2 changed files with 9 additions and 1 deletions

View file

@ -4,7 +4,9 @@ class RemoteDownloader
end
def url
@url ||= File.join(base_url, CarrierWave::Uploader::Base.fog_directory, @filename)
if @filename.present?
@url ||= File.join(base_url, CarrierWave::Uploader::Base.fog_directory, @filename)
end
end
protected

View file

@ -7,5 +7,11 @@ describe RemoteDownloader do
describe '#url' do
it { expect(subject.url).to eq 'https://static.demarches-simplifiees.fr/tps_dev/file_name.pdf' }
context 'no filename' do
let(:filename) { nil }
it { expect(subject.url).to be_nil }
end
end
end