Formulaire → demande, when not editable

This commit is contained in:
gregoirenovel 2018-08-29 16:57:01 +02:00
parent b9a32633bb
commit 6b88968889
8 changed files with 14 additions and 14 deletions

View file

@ -4,8 +4,8 @@ module NewUser
helper_method :new_demarche_url
before_action :ensure_ownership!, except: [:index, :show, :formulaire, :modifier, :update, :recherche]
before_action :ensure_ownership_or_invitation!, only: [:show, :formulaire, :modifier, :update]
before_action :ensure_ownership!, except: [:index, :show, :demande, :modifier, :update, :recherche]
before_action :ensure_ownership_or_invitation!, only: [:show, :demande, :modifier, :update]
before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update]
before_action :forbid_invite_submission!, only: [:update]
@ -34,7 +34,7 @@ module NewUser
@dossier = dossier
end
def formulaire
def demande
@dossier = dossier
end
@ -109,7 +109,7 @@ module NewUser
redirect_to merci_dossier_path(@dossier)
elsif current_user.owns?(dossier)
if Flipflop.new_dossier_details?
redirect_to formulaire_dossier_path(@dossier)
redirect_to demande_dossier_path(@dossier)
else
redirect_to users_dossier_recapitulatif_path(@dossier)
end

View file

@ -9,4 +9,4 @@
%ul.tabs
= active_tab_item('Résumé', dossier_path(dossier))
= active_tab_item('Formulaire', formulaire_dossier_path(dossier))
= active_tab_item('Demande', demande_dossier_path(dossier))

View file

@ -278,7 +278,7 @@ Rails.application.routes.draw do
get 'modifier'
patch 'modifier', to: 'dossiers#update'
get 'merci'
get 'formulaire'
get 'demande'
post 'ask_deletion'
get 'attestation'
end

View file

@ -517,10 +517,10 @@ describe NewUser::DossiersController, type: :controller do
sign_in(user)
end
subject! { get(:formulaire, params: { id: dossier.id }) }
subject! { get(:demande, params: { id: dossier.id }) }
it { expect(assigns(:dossier)).to eq(dossier) }
it { is_expected.to render_template(:formulaire) }
it { is_expected.to render_template(:demande) }
end
describe '#ask_deletion' do

View file

@ -20,16 +20,16 @@ describe 'Dossier details:' do
scenario 'the user can see and edit dossier before instruction' do
visit_dossier dossier
click_on 'Formulaire'
click_on 'Demande'
expect(page).to have_current_path(formulaire_dossier_path(dossier))
expect(page).to have_current_path(demande_dossier_path(dossier))
click_on 'Modifier le dossier'
expect(page).to have_current_path(modifier_dossier_path(dossier))
fill_in('texte obligatoire', with: 'Nouveau texte')
click_on 'Enregistrer les modifications du dossier'
expect(page).to have_current_path(formulaire_dossier_path(dossier))
expect(page).to have_current_path(demande_dossier_path(dossier))
expect(page).to have_content('Nouveau texte')
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe 'new_user/dossiers/formulaire.html.haml', type: :view do
describe 'new_user/dossiers/demande.html.haml', type: :view do
let(:procedure) { create(:procedure, :published, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_type_de_champ_private) }
let(:dossier) { create(:dossier, :en_construction, :with_entreprise, procedure: procedure) }
@ -16,7 +16,7 @@ describe 'new_user/dossiers/formulaire.html.haml', type: :view do
it 'renders the dossier infos' do
expect(rendered).to have_text('Identité')
expect(rendered).to have_text('Formulaire')
expect(rendered).to have_text('Demande')
expect(rendered).to have_text('Pièces jointes')
end

View file

@ -10,6 +10,6 @@ describe 'new_user/dossiers/show/header.html.haml', type: :view do
expect(rendered).to have_selector("ul.tabs")
expect(rendered).to have_link("Résumé", href: dossier_path(dossier))
expect(rendered).to have_link("Formulaire", href: formulaire_dossier_path(dossier))
expect(rendered).to have_link("Demande", href: demande_dossier_path(dossier))
end
end