Remove CGU checkbox

fix #2725
This commit is contained in:
Paul Chavard 2018-10-02 13:51:56 +02:00 committed by Pierre de La Morinerie
parent 651f459dcc
commit 941c529b2c
15 changed files with 17 additions and 119 deletions

View file

@ -162,7 +162,7 @@ describe NewUser::DossiersController, type: :controller do
let(:procedure) { create(:procedure, :for_individual) }
let(:dossier) { create(:dossier, user: user, procedure: procedure) }
subject { post :update_identite, params: { id: dossier.id, individual: individual_params, dossier: dossier_params } }
subject { post :update_identite, params: { id: dossier.id, individual: individual_params } }
before do
sign_in(user)
@ -171,7 +171,6 @@ describe NewUser::DossiersController, type: :controller do
context 'with correct individual and dossier params' do
let(:individual_params) { { gender: 'M', nom: 'Mouse', prenom: 'Mickey' } }
let(:dossier_params) { { autorisation_donnees: true } }
it do
expect(response).to redirect_to(brouillon_dossier_path(dossier))
@ -189,7 +188,6 @@ describe NewUser::DossiersController, type: :controller do
context 'when the identite cannot be updated by the user' do
let(:dossier) { create(:dossier, :for_individual, :en_instruction, user: user, procedure: procedure) }
let(:individual_params) { { gender: 'M', nom: 'Mouse', prenom: 'Mickey' } }
let(:dossier_params) { { autorisation_donnees: true } }
it 'redirects to the dossiers list' do
expect(response).to redirect_to(dossiers_path)
@ -199,11 +197,10 @@ describe NewUser::DossiersController, type: :controller do
context 'with incorrect individual and dossier params' do
let(:individual_params) { { gender: '', nom: '', prenom: '' } }
let(:dossier_params) { { autorisation_donnees: nil } }
it do
expect(response).not_to have_http_status(:redirect)
expect(flash[:alert]).to include("Civilité doit être rempli", "Nom doit être rempli", "Prénom doit être rempli", "Acceptation des CGU doit être coché")
expect(flash[:alert]).to include("Civilité doit être rempli", "Nom doit être rempli", "Prénom doit être rempli")
end
end
end

View file

@ -338,7 +338,7 @@ describe Users::DossiersController, type: :controller do
end
describe 'PUT #update' do
let(:params) { { id: dossier_id, dossier: { id: dossier_id, autorisation_donnees: autorisation_donnees, individual_attributes: individual_params } } }
let(:params) { { id: dossier_id, dossier: { id: dossier_id, individual_attributes: individual_params } } }
let(:individual_params) { { gender: 'M.', nom: 'Julien', prenom: 'Xavier', birthdate: birthdate } }
let(:birthdate) { '20/01/1991' }
subject { put :update, params: params }
@ -351,8 +351,6 @@ describe Users::DossiersController, type: :controller do
end
context 'when Checkbox is checked' do
let(:autorisation_donnees) { '1' }
context 'procedure not use api carto' do
it 'redirects to demande' do
expect(response).to redirect_to(brouillon_dossier_path(dossier))
@ -375,20 +373,6 @@ describe Users::DossiersController, type: :controller do
expect(dossier.autorisation_donnees).to be_truthy
end
end
context 'when Checkbox is not checked' do
let(:autorisation_donnees) { '0' }
it 'uses flash alert to display message' do
expect(flash[:alert]).to have_content('La validation des conditions d\'utilisation est obligatoire')
end
it "doesn't update dossier autorisation_donnees" do
dossier.reload
expect(dossier.autorisation_donnees).to be_falsy
end
it { is_expected.to redirect_to users_dossier_path(id: dossier.id) }
end
end
describe 'DELETE #destroy' do

View file

@ -150,7 +150,6 @@ feature 'The user' do
def fill_individual
fill_in('individual_prenom', with: 'prenom')
fill_in('individual_nom', with: 'nom')
check 'dossier_autorisation_donnees'
click_on 'Continuer'
expect(page).to have_current_path(brouillon_dossier_path(user_dossier))
end

View file

@ -59,7 +59,6 @@ feature 'linked dropdown lists' do
def fill_individual
fill_in('individual_prenom', with: 'prenom')
fill_in('individual_nom', with: 'nom')
check 'dossier_autorisation_donnees'
click_on 'Continuer'
expect(page).to have_current_path(brouillon_dossier_path(user_dossier))
end

View file

@ -60,7 +60,6 @@ feature 'user path for dossier creation' do
context 'when validating info entreprise recap page' do
before do
page.check('dossier_autorisation_donnees')
page.find_by_id('etape_suivante').click
end
scenario 'user is on edition page' do

View file

@ -15,7 +15,6 @@ feature 'As a User I wanna create a dossier' do
visit commencer_path(procedure_path: procedure_for_individual.path)
fill_in 'individual_nom', with: 'Nom'
fill_in 'individual_prenom', with: 'Prenom'
check "dossier_autorisation_donnees"
end
context "when birthday is asked" do
@ -77,14 +76,13 @@ feature 'As a User I wanna create a dossier' do
.to_return(status: 404, body: '')
page.find_by_id('dossier-siret').set siret
page.find_by_id('submit-siret').click
click_on 'Valider'
wait_for_ajax
expect(page).to have_css('#recap-info-entreprise')
check 'dossier_autorisation_donnees'
page.find_by_id('etape_suivante').click
click_on 'Etape suivante'
expect(page).to have_current_path(users_dossier_carte_path(procedure_with_siret.dossiers.last.id.to_s))
page.find_by_id('etape_suivante').click
click_on 'Etape suivante'
expect(page).to have_current_path(brouillon_dossier_path(procedure_with_siret.dossiers.last))
end
end

View file

@ -10,23 +10,11 @@ describe 'dossiers/show.html.haml', type: :view do
render
end
it 'have autorisation_donnees check box' do
expect(rendered).to have_css('#dossier_autorisation_donnees')
end
context "sur la page d'information d'un SIRET" do
it 'Le formulaire envoie vers /users/dossiers/:dossier_id en #POST' do
expect(rendered).to have_selector("form[action='/users/dossiers'][method=post]")
end
it "la checkbox d'information est présente" do
expect(rendered).to have_css('#dossier_autorisation_donnees')
end
it "le texte d'information des droits est correct" do
expect(rendered).to have_content("J'autorise les décideurs publics à vérifier les informations de mon organisation auprès des administrations concernées. Ces informations resteront strictement confidentielles.")
end
it "les informations de l'entreprise sont présents" do
expect(rendered).to have_content('Siret')
end