bug(commencer/test): with procedure without service nor organisation, it crashes
This commit is contained in:
parent
1745f45f0c
commit
2529773515
2 changed files with 12 additions and 4 deletions
|
@ -84,8 +84,8 @@ module Users
|
||||||
|
|
||||||
def generate_empty_pdf(revision)
|
def generate_empty_pdf(revision)
|
||||||
@dossier = revision.new_dossier
|
@dossier = revision.new_dossier
|
||||||
s = render_to_string(template: 'dossiers/dossier_vide', formats: [:pdf])
|
data = render_to_string(template: 'dossiers/dossier_vide', formats: [:pdf])
|
||||||
send_data(s, :filename => "#{revision.procedure.libelle}.pdf")
|
send_data(data, :filename => "#{revision.procedure.libelle}.pdf")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -181,15 +181,23 @@ describe Users::CommencerController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#dossier_vide_test_pdf' do
|
describe '#dossier_vide_test_pdf' do
|
||||||
before { get :dossier_vide_pdf_test, params: { path: procedure.path } }
|
render_views
|
||||||
|
before { get :dossier_vide_pdf_test, params: { path: procedure.path }, format: :pdf }
|
||||||
|
|
||||||
context 'not published procedure' do
|
context 'not published procedure with service' do
|
||||||
let(:procedure) { create(:procedure, :with_service, :with_path) }
|
let(:procedure) { create(:procedure, :with_service, :with_path) }
|
||||||
|
|
||||||
it 'works' do
|
it 'works' do
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
context 'not published procedure without service' do
|
||||||
|
let(:procedure) { create(:procedure, :with_path, service: nil, organisation: nil) }
|
||||||
|
|
||||||
|
it 'works' do
|
||||||
|
expect(response).to have_http_status(:success)
|
||||||
|
end
|
||||||
|
end
|
||||||
context 'published procedure' do
|
context 'published procedure' do
|
||||||
let(:procedure) { create(:procedure, :published, :with_service, :with_path) }
|
let(:procedure) { create(:procedure, :published, :with_service, :with_path) }
|
||||||
it 'redirect to procedure not found' do
|
it 'redirect to procedure not found' do
|
||||||
|
|
Loading…
Reference in a new issue