Merge pull request #2934 from tchak/fix-commentaire-file-url
Fix commentaire file_url generator
This commit is contained in:
commit
77275bb52b
2 changed files with 9 additions and 1 deletions
|
@ -4,7 +4,9 @@ class RemoteDownloader
|
||||||
end
|
end
|
||||||
|
|
||||||
def url
|
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
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -7,5 +7,11 @@ describe RemoteDownloader do
|
||||||
|
|
||||||
describe '#url' do
|
describe '#url' do
|
||||||
it { expect(subject.url).to eq 'https://static.demarches-simplifiees.fr/tps_dev/file_name.pdf' }
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue