Fix commentaire file_url generator
This commit is contained in:
parent
ab98e024c3
commit
8ff45c7978
2 changed files with 9 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue