Remove old user dossier form
This commit is contained in:
parent
d1613b4af1
commit
c91abe73c5
37 changed files with 0 additions and 1276 deletions
|
@ -1,41 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/_pieces_justificatives.html.haml', type: :view do
|
||||
let!(:procedure) { create(:procedure) }
|
||||
let!(:tpj1) do
|
||||
create(
|
||||
:type_de_piece_justificative,
|
||||
procedure: procedure,
|
||||
libelle: "Première pièce jointe",
|
||||
description: "Première description",
|
||||
order_place: 1,
|
||||
mandatory: true
|
||||
)
|
||||
end
|
||||
let!(:tpj2) do
|
||||
create(
|
||||
:type_de_piece_justificative,
|
||||
procedure: procedure,
|
||||
libelle: "Seconde pièce jointe",
|
||||
description: "Seconde description",
|
||||
order_place: 2,
|
||||
lien_demarche: "https://www.google.fr"
|
||||
)
|
||||
end
|
||||
let!(:dossier) { create(:dossier, :procedure => procedure) }
|
||||
|
||||
before do
|
||||
render 'users/description/pieces_justificatives.html.haml', dossier: dossier
|
||||
end
|
||||
|
||||
it 'should render two PJ with their title, mandatory status and description' do
|
||||
expect(rendered).to include("Première pièce jointe *")
|
||||
expect(rendered).to include("Seconde pièce jointe")
|
||||
expect(rendered.index("Première pièce jointe")).to be < rendered.index("Seconde pièce jointe")
|
||||
|
||||
expect(rendered).to include("Première description")
|
||||
expect(rendered).to include("Seconde description")
|
||||
|
||||
expect(rendered).to have_selector("input[type=file]", count: 2)
|
||||
end
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/champs/date.html.haml', type: :view do
|
||||
let(:type_champ) { create(:type_de_champ_date) }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/date.html.haml', champ: champ
|
||||
end
|
||||
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: "2017-09-19").decorate }
|
||||
|
||||
it 'should render an input for the dossier link' do
|
||||
expect(rendered).to have_css("input[value='2017-09-19']")
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/champs/departements.html.haml', vcr: { cassette_name: 'geoapi_departements' }, type: :view do
|
||||
let(:champ) { create(:champ) }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/departements.html.haml', champ: champ.decorate
|
||||
end
|
||||
|
||||
it 'should render departments drop down list' do
|
||||
expect(rendered).to include("Ain")
|
||||
end
|
||||
end
|
|
@ -1,55 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/champs/dossier_link.html.haml', type: :view do
|
||||
let(:type_champ) { create(:type_de_champ_dossier_link) }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/dossier_link.html.haml', champ: champ
|
||||
end
|
||||
|
||||
context 'in all cases' do
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: nil) }
|
||||
|
||||
it 'should render an input for the dossier link' do
|
||||
expect(rendered).to have_css("input[type=number][placeholder='Numéro de dossier']")
|
||||
end
|
||||
end
|
||||
|
||||
context 'When no dossier is provided' do
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: nil) }
|
||||
|
||||
it 'should not display the procedure libelle' do
|
||||
expect(rendered).to have_css('.text-info[style*="display: none"]')
|
||||
end
|
||||
|
||||
it 'should not display a warning' do
|
||||
expect(rendered).to have_css('.text-warning[style*="display: none"]')
|
||||
end
|
||||
end
|
||||
|
||||
context 'When a dossier whith a procedure is provided' do
|
||||
let!(:procedure) { create(:procedure) }
|
||||
let!(:dossier) { create(:dossier, procedure: procedure) }
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: dossier.id) }
|
||||
|
||||
it 'should display the procedure libelle' do
|
||||
expect(rendered).not_to have_css('.text-info[style*="display: none"]')
|
||||
end
|
||||
|
||||
it 'should not display a warning' do
|
||||
expect(rendered).to have_css('.text-warning[style*="display: none"]')
|
||||
end
|
||||
end
|
||||
|
||||
context 'When a unknown dossier id is provided' do
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: 666) }
|
||||
|
||||
it 'should not display the procedure libelle' do
|
||||
expect(rendered).to have_css('.text-info[style*="display: none"]')
|
||||
end
|
||||
|
||||
it 'should display a warning' do
|
||||
expect(rendered).not_to have_css('.text-warning[style*="display: none"]')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,20 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/champs/engagement.html.haml', type: :view do
|
||||
let(:type_champ) { create(:type_de_champ_engagement) }
|
||||
|
||||
subject { render 'users/description/champs/engagement.html.haml', champ: champ }
|
||||
|
||||
context "when the value is on" do
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: "on").decorate }
|
||||
|
||||
it { is_expected.to have_selector("input[type='checkbox'][checked]") }
|
||||
end
|
||||
|
||||
context "when the value is nil" do
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: nil).decorate }
|
||||
|
||||
it { is_expected.to have_selector("input[type='checkbox']") }
|
||||
it { is_expected.not_to have_selector("input[type='checkbox'][checked]") }
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/champs/pays.html.haml', type: :view do
|
||||
let(:champ) { create(:champ) }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/pays.html.haml', champ: champ.decorate
|
||||
end
|
||||
|
||||
it 'should render pays drop down list' do
|
||||
expect(rendered).to include("FRANCE")
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/champs/regions.html.haml', vcr: { cassette_name: 'geoapi_regions' }, type: :view do
|
||||
let(:champ) { create(:champ) }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/regions.html.haml', champ: champ.decorate
|
||||
end
|
||||
|
||||
it 'should render regions drop down list' do
|
||||
expect(rendered).to include("Normandie")
|
||||
end
|
||||
end
|
|
@ -1,55 +0,0 @@
|
|||
describe 'users/description/champs/render_list_champs.html.haml', type: :view do
|
||||
let(:type_champ) { create(:type_de_champ_checkbox) }
|
||||
|
||||
context "with any champ" do
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: nil) }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0
|
||||
end
|
||||
|
||||
it "should render the champ's libelle" do
|
||||
expect(rendered).to have_content(champ.libelle)
|
||||
end
|
||||
end
|
||||
|
||||
context "with a checkbox champ" do
|
||||
context "whose value equals nil" do
|
||||
let!(:champ_checkbox_checked) { create(:champ, type_de_champ: type_champ, value: nil) }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0
|
||||
end
|
||||
|
||||
it 'should not render a checked checkbox' do
|
||||
expect(rendered).not_to have_css('input[type=checkbox][checked]')
|
||||
end
|
||||
end
|
||||
|
||||
context "whose value equals 'on'" do
|
||||
let!(:champ_checkbox_checked) { create(:champ, type_de_champ: type_champ, value: 'on') }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0
|
||||
end
|
||||
|
||||
it 'should render a checked checkbox' do
|
||||
expect(rendered).to have_css('input[type=checkbox][checked]')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a dossier_link' do
|
||||
let(:type_champ) { create(:type_de_champ_dossier_link) }
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: nil) }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0
|
||||
end
|
||||
|
||||
it 'should render the _dossier_link partial' do
|
||||
expect(view).to render_template(partial: 'users/description/champs/_dossier_link',
|
||||
locals: { champ: champ })
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/champs/yes_no.html.haml', type: :view do
|
||||
let(:type_champ) { create(:type_de_champ_yes_no) }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/yes_no.html.haml', champ: champ
|
||||
end
|
||||
|
||||
context "when the value is Oui" do
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: "true").decorate }
|
||||
|
||||
it 'should select the Oui radio button' do
|
||||
expect(rendered).to have_selector("input[value='true'][checked]")
|
||||
end
|
||||
end
|
||||
|
||||
context "when the value is Non" do
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: "false").decorate }
|
||||
|
||||
it 'should select the Non radio button' do
|
||||
expect(rendered).to have_selector("input[value='false'][checked]")
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,108 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/show.html.haml', type: :view do
|
||||
let(:user) { create(:user) }
|
||||
let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_datetime) }
|
||||
let(:dossier) { create(:dossier, procedure: procedure, user: user) }
|
||||
let(:dossier_id) { dossier.id }
|
||||
|
||||
before do
|
||||
sign_in user
|
||||
assign(:dossier, dossier)
|
||||
assign(:procedure, dossier.procedure)
|
||||
assign(:champs, dossier.ordered_champs)
|
||||
end
|
||||
|
||||
context 'tous les attributs sont présents sur la page' do
|
||||
before do
|
||||
render
|
||||
end
|
||||
it 'Le formulaire envoie vers /users/dossiers/:dossier_id/description en #POST' do
|
||||
expect(rendered).to have_selector("form[action='/users/dossiers/#{dossier_id}/description'][method=post]")
|
||||
end
|
||||
end
|
||||
|
||||
context 'si la page précédente n\'est pas recapitulatif' do
|
||||
before do
|
||||
render
|
||||
end
|
||||
it 'le bouton "Terminer" est présent' do
|
||||
expect(rendered).to have_selector('#suivant')
|
||||
end
|
||||
end
|
||||
|
||||
context 'si la page précédente est recapitularif' do
|
||||
before do
|
||||
dossier.en_construction!
|
||||
dossier.reload
|
||||
render
|
||||
end
|
||||
|
||||
it 'le bouton "Terminer" n\'est pas présent' do
|
||||
expect(rendered).to_not have_selector('#suivant')
|
||||
end
|
||||
|
||||
it 'le bouton "Modification terminé" est présent' do
|
||||
expect(rendered).to have_selector('#modification_terminee')
|
||||
end
|
||||
|
||||
it 'le lien de retour au récapitulatif est présent' do
|
||||
expect(rendered).to have_selector("a[href='/users/dossiers/#{dossier_id}/recapitulatif']")
|
||||
end
|
||||
end
|
||||
|
||||
context 'Champs' do
|
||||
let(:champs) { dossier.champs }
|
||||
let(:types_de_champ) { procedure.types_de_champ.where(type_champ: 'datetime').first }
|
||||
let(:champ_datetime) { champs.where(type_de_champ_id: types_de_champ.id).first }
|
||||
|
||||
before do
|
||||
champ_datetime.value = "2016-06-22 12:05"
|
||||
champ_datetime.save
|
||||
render
|
||||
end
|
||||
|
||||
describe 'first champs' do
|
||||
subject { dossier.champs.first }
|
||||
it { expect(rendered).to have_css("#champs_#{subject.id}") }
|
||||
end
|
||||
|
||||
describe 'last champs' do
|
||||
subject { dossier.champs.last }
|
||||
it { expect(rendered).to have_css("#champs_#{subject.id}") }
|
||||
end
|
||||
|
||||
describe 'datetime value is correctly setup when is not nil' do
|
||||
it { expect(rendered).to have_css("input[type='date'][id='champs_#{champ_datetime.id}'][value='2016-06-22']") }
|
||||
it { expect(rendered).to have_css("option[value='12'][selected='selected']") }
|
||||
it { expect(rendered).to have_css("option[value='05'][selected='selected']") }
|
||||
end
|
||||
end
|
||||
|
||||
context 'Pièces justificatives' do
|
||||
let(:all_type_pj_procedure_id) { dossier.procedure.type_de_piece_justificative_ids }
|
||||
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
context 'la liste des pièces justificatives a envoyé est affichée' do
|
||||
it 'RIB' do
|
||||
expect(rendered).to have_css("#piece_justificative_#{all_type_pj_procedure_id[0]}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'display title Documents administratifs' do
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
let(:procedure) { create :procedure, lien_demarche: '' }
|
||||
let(:dossier) { create(:dossier, procedure: procedure) }
|
||||
|
||||
context 'when dossier not have piece justificative and demarche link' do
|
||||
it { expect(rendered).not_to have_content 'Documents administratifs' }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue