Merge pull request #2934 from tchak/fix-commentaire-file-url

Fix commentaire file_url generator
This commit is contained in:
LeSim 2018-10-31 12:58:16 +01:00 committed by GitHub
commit 77275bb52b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -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

View file

@ -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