Merge pull request #2524 from betagouv/new-dossier-improvements
New dossier improvements
This commit is contained in:
commit
3604ee5453
25 changed files with 280 additions and 127 deletions
|
@ -4,10 +4,11 @@ module NewUser
|
||||||
|
|
||||||
helper_method :new_demarche_url
|
helper_method :new_demarche_url
|
||||||
|
|
||||||
before_action :ensure_ownership!, except: [:index, :show, :demande, :messagerie, :modifier, :update, :recherche]
|
before_action :ensure_ownership!, except: [:index, :show, :demande, :messagerie, :brouillon, :update_brouillon, :modifier, :update, :recherche]
|
||||||
before_action :ensure_ownership_or_invitation!, only: [:show, :demande, :messagerie, :modifier, :update, :create_commentaire]
|
before_action :ensure_ownership_or_invitation!, only: [:show, :demande, :messagerie, :brouillon, :update_brouillon, :modifier, :update, :create_commentaire]
|
||||||
before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update]
|
before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update_brouillon, :modifier, :update]
|
||||||
before_action :forbid_invite_submission!, only: [:update]
|
before_action :forbid_invite_submission!, only: [:update_brouillon]
|
||||||
|
before_action :forbid_closed_submission!, only: [:update_brouillon]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@user_dossiers = current_user.dossiers.includes(:procedure).order_by_updated_at.page(page)
|
@user_dossiers = current_user.dossiers.includes(:procedure).order_by_updated_at.page(page)
|
||||||
|
@ -25,7 +26,7 @@ module NewUser
|
||||||
|
|
||||||
def show
|
def show
|
||||||
if dossier.brouillon?
|
if dossier.brouillon?
|
||||||
redirect_to modifier_dossier_path(dossier)
|
redirect_to brouillon_dossier_path(dossier)
|
||||||
|
|
||||||
elsif !Flipflop.new_dossier_details?
|
elsif !Flipflop.new_dossier_details?
|
||||||
redirect_to users_dossier_recapitulatif_path(dossier)
|
redirect_to users_dossier_recapitulatif_path(dossier)
|
||||||
|
@ -64,7 +65,7 @@ module NewUser
|
||||||
if @dossier.procedure.module_api_carto.use_api_carto
|
if @dossier.procedure.module_api_carto.use_api_carto
|
||||||
redirect_to users_dossier_carte_path(@dossier.id)
|
redirect_to users_dossier_carte_path(@dossier.id)
|
||||||
else
|
else
|
||||||
redirect_to modifier_dossier_path(@dossier)
|
redirect_to brouillon_dossier_path(@dossier)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
flash.now.alert = @dossier.errors.full_messages
|
flash.now.alert = @dossier.errors.full_messages
|
||||||
|
@ -72,7 +73,7 @@ module NewUser
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def modifier
|
def brouillon
|
||||||
@dossier = dossier_with_champs
|
@dossier = dossier_with_champs
|
||||||
|
|
||||||
# TODO: remove when the champs are unifed
|
# TODO: remove when the champs are unifed
|
||||||
|
@ -85,41 +86,53 @@ module NewUser
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# FIXME: remove PiecesJustificativesService
|
# FIXME:
|
||||||
# delegate draft save logic to champ ?
|
# - remove PiecesJustificativesService
|
||||||
|
# - delegate draft save logic to champ ?
|
||||||
|
def update_brouillon
|
||||||
|
@dossier = dossier_with_champs
|
||||||
|
|
||||||
|
errors = update_dossier_and_compute_errors
|
||||||
|
|
||||||
|
if errors.present?
|
||||||
|
flash.now.alert = errors
|
||||||
|
render :brouillon
|
||||||
|
else
|
||||||
|
if save_draft?
|
||||||
|
flash.now.notice = 'Votre brouillon a bien été sauvegardé.'
|
||||||
|
render :brouillon
|
||||||
|
else
|
||||||
|
@dossier.en_construction!
|
||||||
|
NotificationMailer.send_initiated_notification(@dossier).deliver_later
|
||||||
|
redirect_to merci_dossier_path(@dossier)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def modifier
|
||||||
|
@dossier = dossier_with_champs
|
||||||
|
end
|
||||||
|
|
||||||
|
# FIXME:
|
||||||
|
# - remove PiecesJustificativesService
|
||||||
def update
|
def update
|
||||||
@dossier = dossier_with_champs
|
@dossier = dossier_with_champs
|
||||||
|
|
||||||
errors = PiecesJustificativesService.upload!(@dossier, current_user, params)
|
errors = update_dossier_and_compute_errors
|
||||||
|
|
||||||
if champs_params[:dossier] && !@dossier.update(champs_params[:dossier])
|
|
||||||
errors += @dossier.errors.full_messages
|
|
||||||
end
|
|
||||||
|
|
||||||
if !draft?
|
|
||||||
errors += @dossier.champs.select(&:mandatory_and_blank?)
|
|
||||||
.map { |c| "Le champ #{c.libelle.truncate(200)} doit être rempli." }
|
|
||||||
errors += PiecesJustificativesService.missing_pj_error_messages(@dossier)
|
|
||||||
end
|
|
||||||
|
|
||||||
if errors.present?
|
if errors.present?
|
||||||
flash.now.alert = errors
|
flash.now.alert = errors
|
||||||
render :modifier
|
render :modifier
|
||||||
elsif draft?
|
|
||||||
flash.now.notice = 'Votre brouillon a bien été sauvegardé.'
|
|
||||||
render :modifier
|
|
||||||
elsif @dossier.can_transition_to_en_construction?
|
|
||||||
@dossier.en_construction!
|
|
||||||
NotificationMailer.send_initiated_notification(@dossier).deliver_later
|
|
||||||
redirect_to merci_dossier_path(@dossier)
|
|
||||||
elsif current_user.owns?(dossier)
|
|
||||||
if Flipflop.new_dossier_details?
|
|
||||||
redirect_to demande_dossier_path(@dossier)
|
|
||||||
else
|
|
||||||
redirect_to users_dossier_recapitulatif_path(@dossier)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
redirect_to users_dossiers_invite_path(@dossier.invite_for_user(current_user))
|
if current_user.owns?(dossier)
|
||||||
|
if Flipflop.new_dossier_details?
|
||||||
|
redirect_to demande_dossier_path(@dossier)
|
||||||
|
else
|
||||||
|
redirect_to users_dossier_recapitulatif_path(@dossier)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
redirect_to users_dossiers_invite_path(@dossier.invite_for_user(current_user))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -209,6 +222,22 @@ module NewUser
|
||||||
Dossier.with_champs.find(params[:id])
|
Dossier.with_champs.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_dossier_and_compute_errors
|
||||||
|
errors = PiecesJustificativesService.upload!(@dossier, current_user, params)
|
||||||
|
|
||||||
|
if champs_params[:dossier] && !@dossier.update(champs_params[:dossier])
|
||||||
|
errors += @dossier.errors.full_messages
|
||||||
|
end
|
||||||
|
|
||||||
|
if !save_draft?
|
||||||
|
errors += @dossier.champs.select(&:mandatory_and_blank?)
|
||||||
|
.map { |c| "Le champ #{c.libelle.truncate(200)} doit être rempli." }
|
||||||
|
errors += PiecesJustificativesService.missing_pj_error_messages(@dossier)
|
||||||
|
end
|
||||||
|
|
||||||
|
errors
|
||||||
|
end
|
||||||
|
|
||||||
def ensure_ownership!
|
def ensure_ownership!
|
||||||
if !current_user.owns?(dossier)
|
if !current_user.owns?(dossier)
|
||||||
forbidden!
|
forbidden!
|
||||||
|
@ -227,6 +256,12 @@ module NewUser
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def forbid_closed_submission!
|
||||||
|
if passage_en_construction? && !dossier.can_transition_to_en_construction?
|
||||||
|
forbidden!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def forbidden!
|
def forbidden!
|
||||||
flash[:alert] = "Vous n'avez pas accès à ce dossier"
|
flash[:alert] = "Vous n'avez pas accès à ce dossier"
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
|
@ -245,10 +280,10 @@ module NewUser
|
||||||
end
|
end
|
||||||
|
|
||||||
def passage_en_construction?
|
def passage_en_construction?
|
||||||
dossier.brouillon? && !draft?
|
dossier.brouillon? && !save_draft?
|
||||||
end
|
end
|
||||||
|
|
||||||
def draft?
|
def save_draft?
|
||||||
params[:save_draft]
|
params[:save_draft]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Users::CarteController < UsersController
|
||||||
|
|
||||||
dossier.update(json_latlngs: safe_json_latlngs)
|
dossier.update(json_latlngs: safe_json_latlngs)
|
||||||
|
|
||||||
redirect_to modifier_dossier_path(dossier)
|
redirect_to brouillon_dossier_path(dossier)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_position
|
def get_position
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Users::Dossiers::InvitesController < UsersController
|
||||||
@facade = InviteDossierFacades.new params[:id].to_i, current_user.email
|
@facade = InviteDossierFacades.new params[:id].to_i, current_user.email
|
||||||
|
|
||||||
if @facade.dossier.brouillon?
|
if @facade.dossier.brouillon?
|
||||||
redirect_to modifier_dossier_path(@facade.dossier)
|
redirect_to brouillon_dossier_path(@facade.dossier)
|
||||||
else
|
else
|
||||||
render 'users/recapitulatif/show'
|
render 'users/recapitulatif/show'
|
||||||
end
|
end
|
||||||
|
|
|
@ -142,7 +142,7 @@ class Users::DossiersController < UsersController
|
||||||
if @facade.dossier.procedure.module_api_carto.use_api_carto
|
if @facade.dossier.procedure.module_api_carto.use_api_carto
|
||||||
redirect_to url_for(controller: :carte, action: :show, dossier_id: @facade.dossier.id)
|
redirect_to url_for(controller: :carte, action: :show, dossier_id: @facade.dossier.id)
|
||||||
else
|
else
|
||||||
redirect_to modifier_dossier_path(@facade.dossier)
|
redirect_to brouillon_dossier_path(@facade.dossier)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,7 @@ module DossierHelper
|
||||||
|
|
||||||
def url_for_dossier(dossier)
|
def url_for_dossier(dossier)
|
||||||
if dossier.brouillon?
|
if dossier.brouillon?
|
||||||
modifier_dossier_path(dossier)
|
brouillon_dossier_path(dossier)
|
||||||
else
|
else
|
||||||
users_dossier_recapitulatif_path(dossier)
|
users_dossier_recapitulatif_path(dossier)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
- if !@facade.dossier.read_only?
|
- if !@facade.dossier.read_only?
|
||||||
- if user_signed_in? && (current_user.owns_or_invite?(@facade.dossier))
|
- if user_signed_in? && (current_user.owns_or_invite?(@facade.dossier))
|
||||||
= link_to modifier_dossier_path(@facade.dossier), class: 'action', id: 'maj_infos' do
|
= link_to brouillon_dossier_path(@facade.dossier), class: 'action', id: 'maj_infos' do
|
||||||
#edit-dossier.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
|
#edit-dossier.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
|
||||||
= "MODIFIER"
|
= "MODIFIER"
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
- if champ.type_champ == TypeDeChamp.type_champs.fetch(:dossier_link)
|
- if champ.type_champ == TypeDeChamp.type_champs.fetch(:dossier_link)
|
||||||
- dossier = Dossier.includes(:procedure).find_by(id: champ.decorate.value)
|
- dossier = Dossier.includes(:procedure).find_by(id: champ.decorate.value)
|
||||||
- if dossier
|
- if dossier
|
||||||
= link_to("Dossier #{dossier.id}", modifier_dossier_path(dossier), target: '_blank')
|
= link_to("Dossier #{dossier.id}", brouillon_dossier_path(dossier), target: '_blank')
|
||||||
%br
|
%br
|
||||||
= sanitize(dossier.text_summary)
|
= sanitize(dossier.text_summary)
|
||||||
- else
|
- else
|
||||||
|
|
11
app/views/new_user/dossiers/brouillon.html.haml
Normal file
11
app/views/new_user/dossiers/brouillon.html.haml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
- content_for(:title, "Modification du brouillon nº #{@dossier.id} (#{@dossier.procedure.libelle})")
|
||||||
|
|
||||||
|
- content_for :footer do
|
||||||
|
= render partial: "new_user/dossiers/footer", locals: { dossier: @dossier }
|
||||||
|
|
||||||
|
.dossier-edit
|
||||||
|
.dossier-header.sub-header
|
||||||
|
.container
|
||||||
|
= render partial: "shared/dossiers/header", locals: { dossier: @dossier, apercu: false }
|
||||||
|
|
||||||
|
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: false }
|
|
@ -1,11 +1,7 @@
|
||||||
- content_for(:title, "Modification du brouillon nº #{@dossier.id} (#{@dossier.procedure.libelle})")
|
- content_for(:title, "Modifier · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})")
|
||||||
|
|
||||||
- content_for :footer do
|
#dossier-show
|
||||||
= render partial: "new_user/dossiers/footer", locals: { dossier: @dossier }
|
= render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier }
|
||||||
|
|
||||||
.dossier-edit
|
.container
|
||||||
.dossier-header.sub-header
|
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: false }
|
||||||
.container
|
|
||||||
= render partial: "shared/dossiers/header", locals: { dossier: @dossier, apercu: false }
|
|
||||||
|
|
||||||
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: false }
|
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
|
|
||||||
- if apercu
|
- if apercu
|
||||||
- form_options = { url: '', method: :get, html: { class: 'form', multipart: true } }
|
- form_options = { url: '', method: :get, html: { class: 'form', multipart: true } }
|
||||||
|
- elsif dossier.brouillon?
|
||||||
|
- form_options = { url: brouillon_dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true } }
|
||||||
- else
|
- else
|
||||||
- form_options = { url: modifier_dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true } }
|
- form_options = { url: dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true } }
|
||||||
|
|
||||||
= form_for dossier, form_options do |f|
|
= form_for dossier, form_options do |f|
|
||||||
|
|
||||||
|
|
|
@ -275,8 +275,10 @@ Rails.application.routes.draw do
|
||||||
member do
|
member do
|
||||||
get 'identite'
|
get 'identite'
|
||||||
patch 'update_identite'
|
patch 'update_identite'
|
||||||
get 'modifier'
|
get 'brouillon'
|
||||||
patch 'modifier', to: 'dossiers#update'
|
patch 'brouillon', to: 'dossiers#update_brouillon'
|
||||||
|
get 'modifier', to: 'dossiers#modifier'
|
||||||
|
patch ':id', to: 'dossiers#update'
|
||||||
get 'merci'
|
get 'merci'
|
||||||
get 'demande'
|
get 'demande'
|
||||||
get 'messagerie'
|
get 'messagerie'
|
||||||
|
|
|
@ -69,14 +69,14 @@ describe InvitesController, type: :controller do
|
||||||
|
|
||||||
context 'when user has access to dossier' do
|
context 'when user has access to dossier' do
|
||||||
before do
|
before do
|
||||||
request.env["HTTP_REFERER"] = "/dossiers/#{dossier.id}/modifier"
|
request.env["HTTP_REFERER"] = "/dossiers/#{dossier.id}/brouillon"
|
||||||
dossier.update(user: signed_in_profile)
|
dossier.update(user: signed_in_profile)
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect { subject }.to change(InviteUser, :count).by(1) }
|
it { expect { subject }.to change(InviteUser, :count).by(1) }
|
||||||
|
|
||||||
it "redirects to the previous URL" do
|
it "redirects to the previous URL" do
|
||||||
expect(subject).to redirect_to("/dossiers/#{dossier.id}/modifier")
|
expect(subject).to redirect_to("/dossiers/#{dossier.id}/brouillon")
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when email is assign to an user' do
|
context 'when email is assign to an user' do
|
||||||
|
|
|
@ -174,7 +174,7 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
let(:dossier_params) { { autorisation_donnees: true } }
|
let(:dossier_params) { { autorisation_donnees: true } }
|
||||||
|
|
||||||
it do
|
it do
|
||||||
expect(response).to redirect_to(modifier_dossier_path(dossier))
|
expect(response).to redirect_to(brouillon_dossier_path(dossier))
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on a procedure with carto' do
|
context 'on a procedure with carto' do
|
||||||
|
@ -208,14 +208,14 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#modifier' do
|
describe '#brouillon' do
|
||||||
before { sign_in(user) }
|
before { sign_in(user) }
|
||||||
let!(:dossier) { create(:dossier, user: user, autorisation_donnees: true) }
|
let!(:dossier) { create(:dossier, user: user, autorisation_donnees: true) }
|
||||||
|
|
||||||
subject { get :modifier, params: { id: dossier.id } }
|
subject { get :brouillon, params: { id: dossier.id } }
|
||||||
|
|
||||||
context 'when autorisation_donnees is checked' do
|
context 'when autorisation_donnees is checked' do
|
||||||
it { is_expected.to render_template(:modifier) }
|
it { is_expected.to render_template(:brouillon) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when autorisation_donnees is not checked' do
|
context 'when autorisation_donnees is not checked' do
|
||||||
|
@ -238,12 +238,12 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
let!(:dossier) { create(:dossier, user: user) }
|
let!(:dossier) { create(:dossier, user: user) }
|
||||||
|
|
||||||
it 'returns the edit page' do
|
it 'returns the edit page' do
|
||||||
get :modifier, params: { id: dossier.id }
|
get :brouillon, params: { id: dossier.id }
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#update' do
|
describe '#update_brouillon' do
|
||||||
before { sign_in(user) }
|
before { sign_in(user) }
|
||||||
let!(:dossier) { create(:dossier, user: user) }
|
let!(:dossier) { create(:dossier, user: user) }
|
||||||
let(:first_champ) { dossier.champs.first }
|
let(:first_champ) { dossier.champs.first }
|
||||||
|
@ -261,7 +261,7 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
let(:payload) { submit_payload }
|
let(:payload) { submit_payload }
|
||||||
|
|
||||||
subject { patch :update, params: payload }
|
subject { patch :update_brouillon, params: payload }
|
||||||
|
|
||||||
context 'when the dossier cannot be updated by the user' do
|
context 'when the dossier cannot be updated by the user' do
|
||||||
let!(:dossier) { create(:dossier, :en_instruction, user: user) }
|
let!(:dossier) { create(:dossier, :en_instruction, user: user) }
|
||||||
|
@ -295,7 +295,7 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sends an email only on the first #update' do
|
it 'sends an email only on the first #update_brouillon' do
|
||||||
delivery = double
|
delivery = double
|
||||||
expect(delivery).to receive(:deliver_later).with(no_args)
|
expect(delivery).to receive(:deliver_later).with(no_args)
|
||||||
|
|
||||||
|
@ -309,6 +309,137 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
subject
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when the update fails' do
|
||||||
|
before do
|
||||||
|
expect_any_instance_of(Dossier).to receive(:save).and_return(false)
|
||||||
|
expect_any_instance_of(Dossier).to receive(:errors)
|
||||||
|
.and_return(double(full_messages: ['nop']))
|
||||||
|
|
||||||
|
subject
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(response).to render_template(:brouillon) }
|
||||||
|
it { expect(flash.alert).to eq(['nop']) }
|
||||||
|
|
||||||
|
it 'does not send an email' do
|
||||||
|
expect(NotificationMailer).not_to receive(:send_initiated_notification)
|
||||||
|
|
||||||
|
subject
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when the pj service returns an error' do
|
||||||
|
before do
|
||||||
|
expect(PiecesJustificativesService).to receive(:upload!).and_return(['nop'])
|
||||||
|
|
||||||
|
subject
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(response).to render_template(:brouillon) }
|
||||||
|
it { expect(flash.alert).to eq(['nop']) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when a mandatory champ is missing' do
|
||||||
|
let(:value) { nil }
|
||||||
|
|
||||||
|
before do
|
||||||
|
first_champ.type_de_champ.update(mandatory: true, libelle: 'l')
|
||||||
|
allow(PiecesJustificativesService).to receive(:missing_pj_error_messages).and_return(['pj'])
|
||||||
|
|
||||||
|
subject
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(response).to render_template(:brouillon) }
|
||||||
|
it { expect(flash.alert).to eq(['Le champ l doit être rempli.', 'pj']) }
|
||||||
|
|
||||||
|
context 'and the user saves a draft' do
|
||||||
|
let(:payload) { submit_payload.merge(save_draft: true) }
|
||||||
|
|
||||||
|
it { expect(response).to render_template(:brouillon) }
|
||||||
|
it { expect(flash.notice).to eq('Votre brouillon a bien été sauvegardé.') }
|
||||||
|
it { expect(dossier.reload.state).to eq(Dossier.states.fetch(:brouillon)) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when dossier has no champ' do
|
||||||
|
let(:submit_payload) { { id: dossier.id } }
|
||||||
|
|
||||||
|
it 'does not raise any errors' do
|
||||||
|
subject
|
||||||
|
|
||||||
|
expect(response).to redirect_to(merci_dossier_path(dossier))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when the user has an invitation but is not the owner' do
|
||||||
|
let(:dossier) { create(:dossier) }
|
||||||
|
let!(:invite) { create(:invite, dossier: dossier, user: user, type: 'InviteUser') }
|
||||||
|
|
||||||
|
context 'and the invite saves a draft' do
|
||||||
|
let(:payload) { submit_payload.merge(save_draft: true) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
first_champ.type_de_champ.update(mandatory: true, libelle: 'l')
|
||||||
|
allow(PiecesJustificativesService).to receive(:missing_pj_error_messages).and_return(['pj'])
|
||||||
|
|
||||||
|
subject
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(response).to render_template(:brouillon) }
|
||||||
|
it { expect(flash.notice).to eq('Votre brouillon a bien été sauvegardé.') }
|
||||||
|
it { expect(dossier.reload.state).to eq(Dossier.states.fetch(:brouillon)) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'and the invite tries to submit the dossier' do
|
||||||
|
before { subject }
|
||||||
|
|
||||||
|
it { expect(response).to redirect_to(root_path) }
|
||||||
|
it { expect(flash.alert).to eq("Vous n'avez pas accès à ce dossier") }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#update' do
|
||||||
|
before { sign_in(user) }
|
||||||
|
let!(:dossier) { create(:dossier, :en_construction, user: user) }
|
||||||
|
let(:first_champ) { dossier.champs.first }
|
||||||
|
let(:value) { 'beautiful value' }
|
||||||
|
let(:submit_payload) do
|
||||||
|
{
|
||||||
|
id: dossier.id,
|
||||||
|
dossier: {
|
||||||
|
champs_attributes: {
|
||||||
|
id: first_champ.id,
|
||||||
|
value: value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
let(:payload) { submit_payload }
|
||||||
|
|
||||||
|
subject { patch :update, params: payload }
|
||||||
|
|
||||||
|
context 'when the dossier cannot be updated by the user' do
|
||||||
|
let!(:dossier) { create(:dossier, :en_instruction, user: user) }
|
||||||
|
|
||||||
|
it 'redirects to the dossiers list' do
|
||||||
|
subject
|
||||||
|
|
||||||
|
expect(response).to redirect_to(dossiers_path)
|
||||||
|
expect(flash.alert).to eq('Votre dossier ne peut plus être modifié')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when dossier can be updated by the owner' do
|
||||||
|
it 'updates the champs' do
|
||||||
|
subject
|
||||||
|
|
||||||
|
expect(response).to redirect_to(users_dossier_recapitulatif_path(dossier))
|
||||||
|
expect(first_champ.reload.value).to eq('beautiful value')
|
||||||
|
expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_construction))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'when the update fails' do
|
context 'when the update fails' do
|
||||||
before do
|
before do
|
||||||
expect_any_instance_of(Dossier).to receive(:save).and_return(false)
|
expect_any_instance_of(Dossier).to receive(:save).and_return(false)
|
||||||
|
@ -351,14 +482,6 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
|
|
||||||
it { expect(response).to render_template(:modifier) }
|
it { expect(response).to render_template(:modifier) }
|
||||||
it { expect(flash.alert).to eq(['Le champ l doit être rempli.', 'pj']) }
|
it { expect(flash.alert).to eq(['Le champ l doit être rempli.', 'pj']) }
|
||||||
|
|
||||||
context 'and the user saves a draft' do
|
|
||||||
let(:payload) { submit_payload.merge(save_draft: true) }
|
|
||||||
|
|
||||||
it { expect(response).to render_template(:modifier) }
|
|
||||||
it { expect(flash.notice).to eq('Votre brouillon a bien été sauvegardé.') }
|
|
||||||
it { expect(dossier.reload.state).to eq(Dossier.states.fetch(:brouillon)) }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when dossier has no champ' do
|
context 'when dossier has no champ' do
|
||||||
|
@ -367,7 +490,7 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
it 'does not raise any errors' do
|
it 'does not raise any errors' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(response).to redirect_to(merci_dossier_path(dossier))
|
expect(response).to redirect_to(users_dossier_recapitulatif_path(dossier))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -375,38 +498,14 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
let(:dossier) { create(:dossier) }
|
let(:dossier) { create(:dossier) }
|
||||||
let!(:invite) { create(:invite, dossier: dossier, user: user, type: 'InviteUser') }
|
let!(:invite) { create(:invite, dossier: dossier, user: user, type: 'InviteUser') }
|
||||||
|
|
||||||
context 'and the invite saves a draft' do
|
before do
|
||||||
let(:payload) { submit_payload.merge(save_draft: true) }
|
dossier.en_construction!
|
||||||
|
subject
|
||||||
before do
|
|
||||||
first_champ.type_de_champ.update(mandatory: true, libelle: 'l')
|
|
||||||
allow(PiecesJustificativesService).to receive(:missing_pj_error_messages).and_return(['pj'])
|
|
||||||
|
|
||||||
subject
|
|
||||||
end
|
|
||||||
|
|
||||||
it { expect(response).to render_template(:modifier) }
|
|
||||||
it { expect(flash.notice).to eq('Votre brouillon a bien été sauvegardé.') }
|
|
||||||
it { expect(dossier.reload.state).to eq(Dossier.states.fetch(:brouillon)) }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and the invite tries to submit the dossier' do
|
it { expect(first_champ.reload.value).to eq('beautiful value') }
|
||||||
before { subject }
|
it { expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_construction)) }
|
||||||
|
it { expect(response).to redirect_to(users_dossiers_invite_path(invite)) }
|
||||||
it { expect(response).to redirect_to(root_path) }
|
|
||||||
it { expect(flash.alert).to eq("Vous n'avez pas accès à ce dossier") }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'and the invite updates a dossier en constructions' do
|
|
||||||
before do
|
|
||||||
dossier.en_construction!
|
|
||||||
subject
|
|
||||||
end
|
|
||||||
|
|
||||||
it { expect(first_champ.reload.value).to eq('beautiful value') }
|
|
||||||
it { expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_construction)) }
|
|
||||||
it { expect(response).to redirect_to(users_dossiers_invite_path(invite)) }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -486,11 +585,15 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
sign_in(user)
|
sign_in(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
Flipflop::FeatureSet.current.test!.switch!(:new_dossier_details, false)
|
||||||
|
end
|
||||||
|
|
||||||
subject! { get(:show, params: { id: dossier.id }) }
|
subject! { get(:show, params: { id: dossier.id }) }
|
||||||
|
|
||||||
context 'when the dossier is a brouillon' do
|
context 'when the dossier is a brouillon' do
|
||||||
let(:dossier) { create(:dossier, user: user) }
|
let(:dossier) { create(:dossier, user: user) }
|
||||||
it { is_expected.to redirect_to(modifier_dossier_path(dossier)) }
|
it { is_expected.to redirect_to(brouillon_dossier_path(dossier)) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the dossier has been submitted' do
|
context 'when the dossier has been submitted' do
|
||||||
|
@ -517,6 +620,10 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
sign_in(user)
|
sign_in(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
Flipflop::FeatureSet.current.test!.switch!(:new_dossier_details, false)
|
||||||
|
end
|
||||||
|
|
||||||
subject! { get(:demande, params: { id: dossier.id }) }
|
subject! { get(:demande, params: { id: dossier.id }) }
|
||||||
|
|
||||||
it { expect(assigns(:dossier)).to eq(dossier) }
|
it { expect(assigns(:dossier)).to eq(dossier) }
|
||||||
|
|
|
@ -105,7 +105,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'Redirection vers le formulaire de la procedure' do
|
it 'Redirection vers le formulaire de la procedure' do
|
||||||
expect(response).to redirect_to(modifier_dossier_path(dossier))
|
expect(response).to redirect_to(brouillon_dossier_path(dossier))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ describe Users::Dossiers::InvitesController, type: :controller do
|
||||||
let(:dossier) { create :dossier, state: Dossier.states.fetch(:brouillon) }
|
let(:dossier) { create :dossier, state: Dossier.states.fetch(:brouillon) }
|
||||||
|
|
||||||
it { is_expected.to have_http_status(302) }
|
it { is_expected.to have_http_status(302) }
|
||||||
it { is_expected.to redirect_to modifier_dossier_path(dossier) }
|
it { is_expected.to redirect_to brouillon_dossier_path(dossier) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and dossier is not a brouillon' do
|
context 'and dossier is not a brouillon' do
|
||||||
|
|
|
@ -355,7 +355,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
|
|
||||||
context 'procedure not use api carto' do
|
context 'procedure not use api carto' do
|
||||||
it 'redirects to demande' do
|
it 'redirects to demande' do
|
||||||
expect(response).to redirect_to(modifier_dossier_path(dossier))
|
expect(response).to redirect_to(brouillon_dossier_path(dossier))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -96,12 +96,12 @@ feature 'The user' do
|
||||||
click_on 'Enregistrer le brouillon'
|
click_on 'Enregistrer le brouillon'
|
||||||
expect(user_dossier.reload.brouillon?).to be(true)
|
expect(user_dossier.reload.brouillon?).to be(true)
|
||||||
expect(page).to have_content('Votre brouillon a bien été sauvegardé')
|
expect(page).to have_content('Votre brouillon a bien été sauvegardé')
|
||||||
expect(page).to have_current_path(modifier_dossier_path(user_dossier))
|
expect(page).to have_current_path(brouillon_dossier_path(user_dossier))
|
||||||
|
|
||||||
# Check an incomplete dossier cannot be submitted when mandatory fields are missing
|
# Check an incomplete dossier cannot be submitted when mandatory fields are missing
|
||||||
click_on 'Soumettre le dossier'
|
click_on 'Soumettre le dossier'
|
||||||
expect(user_dossier.reload.brouillon?).to be(true)
|
expect(user_dossier.reload.brouillon?).to be(true)
|
||||||
expect(page).to have_current_path(modifier_dossier_path(user_dossier))
|
expect(page).to have_current_path(brouillon_dossier_path(user_dossier))
|
||||||
|
|
||||||
# Check a dossier can be submitted when all mandatory fields are filled
|
# Check a dossier can be submitted when all mandatory fields are filled
|
||||||
fill_in('texte obligatoire', with: 'super texte')
|
fill_in('texte obligatoire', with: 'super texte')
|
||||||
|
@ -152,7 +152,7 @@ feature 'The user' do
|
||||||
fill_in('individual_nom', with: 'nom')
|
fill_in('individual_nom', with: 'nom')
|
||||||
check 'dossier_autorisation_donnees'
|
check 'dossier_autorisation_donnees'
|
||||||
click_on 'Continuer'
|
click_on 'Continuer'
|
||||||
expect(page).to have_current_path(modifier_dossier_path(user_dossier))
|
expect(page).to have_current_path(brouillon_dossier_path(user_dossier))
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_date_and_time(date, field)
|
def select_date_and_time(date, field)
|
||||||
|
|
|
@ -16,7 +16,7 @@ feature 'Invitations' do
|
||||||
fill_in 'Libelle du champ', with: 'Some edited value'
|
fill_in 'Libelle du champ', with: 'Some edited value'
|
||||||
send_invite_to "user_invite@exemple.fr"
|
send_invite_to "user_invite@exemple.fr"
|
||||||
|
|
||||||
expect(page).to have_current_path(modifier_dossier_path(dossier))
|
expect(page).to have_current_path(brouillon_dossier_path(dossier))
|
||||||
expect(page).to have_text("Une invitation a été envoyée à user_invite@exemple.fr.")
|
expect(page).to have_text("Une invitation a été envoyée à user_invite@exemple.fr.")
|
||||||
expect(page).to have_text("user_invite@exemple.fr")
|
expect(page).to have_text("user_invite@exemple.fr")
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ feature 'Invitations' do
|
||||||
expect(page).to have_current_path(new_user_session_path)
|
expect(page).to have_current_path(new_user_session_path)
|
||||||
|
|
||||||
submit_login_form(invited_user)
|
submit_login_form(invited_user)
|
||||||
expect(page).to have_current_path(modifier_dossier_path(dossier))
|
expect(page).to have_current_path(brouillon_dossier_path(dossier))
|
||||||
expect(page).to have_no_selector('.button.invite-user-action')
|
expect(page).to have_no_selector('.button.invite-user-action')
|
||||||
|
|
||||||
fill_in 'Libelle du champ', with: 'Some edited value'
|
fill_in 'Libelle du champ', with: 'Some edited value'
|
||||||
|
@ -43,7 +43,7 @@ feature 'Invitations' do
|
||||||
expect(page).to have_current_path(new_user_session_path)
|
expect(page).to have_current_path(new_user_session_path)
|
||||||
|
|
||||||
submit_login_form(invited_user)
|
submit_login_form(invited_user)
|
||||||
expect(page).to have_current_path(modifier_dossier_path(dossier))
|
expect(page).to have_current_path(brouillon_dossier_path(dossier))
|
||||||
|
|
||||||
expect(page).to have_button('Soumettre le dossier', disabled: true)
|
expect(page).to have_button('Soumettre le dossier', disabled: true)
|
||||||
expect(page).to have_selector('.invite-cannot-submit')
|
expect(page).to have_selector('.invite-cannot-submit')
|
||||||
|
@ -75,10 +75,10 @@ feature 'Invitations' do
|
||||||
|
|
||||||
# We should be able to just click() the link, but Capybara detects that the
|
# We should be able to just click() the link, but Capybara detects that the
|
||||||
# enclosing div would be clicked instead.
|
# enclosing div would be clicked instead.
|
||||||
expect(page).to have_link("MODIFIER", href: modifier_dossier_path(dossier))
|
expect(page).to have_link("MODIFIER", href: brouillon_dossier_path(dossier))
|
||||||
visit modifier_dossier_path(dossier)
|
visit brouillon_dossier_path(dossier)
|
||||||
|
|
||||||
expect(page).to have_current_path(modifier_dossier_path(dossier))
|
expect(page).to have_current_path(brouillon_dossier_path(dossier))
|
||||||
fill_in "Libelle du champ", with: "Some edited value"
|
fill_in "Libelle du champ", with: "Some edited value"
|
||||||
click_button "Enregistrer les modifications du dossier"
|
click_button "Enregistrer les modifications du dossier"
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ feature 'Invitations' do
|
||||||
def navigate_to_brouillon(dossier)
|
def navigate_to_brouillon(dossier)
|
||||||
expect(page).to have_current_path(dossiers_path)
|
expect(page).to have_current_path(dossiers_path)
|
||||||
click_on(dossier.id)
|
click_on(dossier.id)
|
||||||
expect(page).to have_current_path(modifier_dossier_path(dossier))
|
expect(page).to have_current_path(brouillon_dossier_path(dossier))
|
||||||
end
|
end
|
||||||
|
|
||||||
def navigate_to_recapitulatif(dossier)
|
def navigate_to_recapitulatif(dossier)
|
||||||
|
|
|
@ -61,7 +61,7 @@ feature 'linked dropdown lists' do
|
||||||
fill_in('individual_nom', with: 'nom')
|
fill_in('individual_nom', with: 'nom')
|
||||||
check 'dossier_autorisation_donnees'
|
check 'dossier_autorisation_donnees'
|
||||||
click_on 'Continuer'
|
click_on 'Continuer'
|
||||||
expect(page).to have_current_path(modifier_dossier_path(user_dossier))
|
expect(page).to have_current_path(brouillon_dossier_path(user_dossier))
|
||||||
end
|
end
|
||||||
|
|
||||||
def primary_id_for(libelle)
|
def primary_id_for(libelle)
|
||||||
|
|
|
@ -64,7 +64,7 @@ feature 'user path for dossier creation' do
|
||||||
page.find_by_id('etape_suivante').click
|
page.find_by_id('etape_suivante').click
|
||||||
end
|
end
|
||||||
scenario 'user is on edition page' do
|
scenario 'user is on edition page' do
|
||||||
expect(page).to have_current_path(modifier_dossier_path(Dossier.last))
|
expect(page).to have_current_path(brouillon_dossier_path(Dossier.last))
|
||||||
end
|
end
|
||||||
context 'user fill and validate description page' do
|
context 'user fill and validate description page' do
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -28,7 +28,7 @@ feature 'As a User I wanna create a dossier' do
|
||||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id))
|
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id))
|
||||||
click_button('Etape suivante')
|
click_button('Etape suivante')
|
||||||
|
|
||||||
expect(page).to have_current_path(modifier_dossier_path(procedure_for_individual.dossiers.last))
|
expect(page).to have_current_path(brouillon_dossier_path(procedure_for_individual.dossiers.last))
|
||||||
|
|
||||||
expect(user.dossiers.first.individual.birthdate).to eq(Date.new(1987, 10, 14))
|
expect(user.dossiers.first.individual.birthdate).to eq(Date.new(1987, 10, 14))
|
||||||
end
|
end
|
||||||
|
@ -40,7 +40,7 @@ feature 'As a User I wanna create a dossier' do
|
||||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
|
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||||
click_button('Etape suivante')
|
click_button('Etape suivante')
|
||||||
|
|
||||||
expect(page).to have_current_path(modifier_dossier_path(procedure_for_individual.dossiers.last))
|
expect(page).to have_current_path(brouillon_dossier_path(procedure_for_individual.dossiers.last))
|
||||||
|
|
||||||
expect(user.dossiers.first.individual.birthdate).to eq(Date.new(1987, 10, 14))
|
expect(user.dossiers.first.individual.birthdate).to eq(Date.new(1987, 10, 14))
|
||||||
end
|
end
|
||||||
|
@ -55,7 +55,7 @@ feature 'As a User I wanna create a dossier' do
|
||||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last))
|
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last))
|
||||||
click_button('Etape suivante')
|
click_button('Etape suivante')
|
||||||
|
|
||||||
expect(page).to have_current_path(modifier_dossier_path(procedure_for_individual.dossiers.last))
|
expect(page).to have_current_path(brouillon_dossier_path(procedure_for_individual.dossiers.last))
|
||||||
|
|
||||||
expect(user.dossiers.first.individual.birthdate).to eq(nil)
|
expect(user.dossiers.first.individual.birthdate).to eq(nil)
|
||||||
end
|
end
|
||||||
|
@ -85,7 +85,7 @@ feature 'As a User I wanna create a dossier' do
|
||||||
page.find_by_id('etape_suivante').click
|
page.find_by_id('etape_suivante').click
|
||||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_with_siret.dossiers.last.id.to_s))
|
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
|
page.find_by_id('etape_suivante').click
|
||||||
expect(page).to have_current_path(modifier_dossier_path(procedure_with_siret.dossiers.last))
|
expect(page).to have_current_path(brouillon_dossier_path(procedure_with_siret.dossiers.last))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,7 +31,7 @@ RSpec.describe DossierHelper, type: :helper do
|
||||||
|
|
||||||
context "when the dossier is in the brouillon state" do
|
context "when the dossier is in the brouillon state" do
|
||||||
let(:dossier) { create(:dossier, state: Dossier.states.fetch(:brouillon)) }
|
let(:dossier) { create(:dossier, state: Dossier.states.fetch(:brouillon)) }
|
||||||
it { is_expected.to eq "/dossiers/#{dossier.id}/modifier" }
|
it { is_expected.to eq "/dossiers/#{dossier.id}/brouillon" }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when the dossier is any other state" do
|
context "when the dossier is any other state" do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'new_user/dossiers/modifier.html.haml', type: :view do
|
describe 'new_user/dossiers/brouillon.html.haml', type: :view do
|
||||||
let(:procedure) { create(:procedure, :with_api_carto, :with_two_type_de_piece_justificative, :with_notice, for_individual: true) }
|
let(:procedure) { create(:procedure, :with_api_carto, :with_two_type_de_piece_justificative, :with_notice, for_individual: true) }
|
||||||
let(:dossier) { create(:dossier, :with_entreprise, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
|
let(:dossier) { create(:dossier, :with_entreprise, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
|
||||||
let(:footer) { view.content_for(:footer) }
|
let(:footer) { view.content_for(:footer) }
|
|
@ -26,7 +26,7 @@ describe 'new_user/dossiers/index.html.haml', type: :view do
|
||||||
dossier = user_dossiers.first
|
dossier = user_dossiers.first
|
||||||
expect(rendered).to have_text(dossier_brouillon.id)
|
expect(rendered).to have_text(dossier_brouillon.id)
|
||||||
expect(rendered).to have_text(dossier_brouillon.procedure.libelle)
|
expect(rendered).to have_text(dossier_brouillon.procedure.libelle)
|
||||||
expect(rendered).to have_link(dossier_brouillon.id, href: modifier_dossier_path(dossier_brouillon))
|
expect(rendered).to have_link(dossier_brouillon.id, href: brouillon_dossier_path(dossier_brouillon))
|
||||||
|
|
||||||
expect(rendered).to have_text(dossier_en_construction.id)
|
expect(rendered).to have_text(dossier_en_construction.id)
|
||||||
expect(rendered).to have_text(dossier_en_construction.procedure.libelle)
|
expect(rendered).to have_text(dossier_en_construction.procedure.libelle)
|
||||||
|
|
|
@ -31,7 +31,7 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'le lien vers l édition est correct' do
|
it 'le lien vers l édition est correct' do
|
||||||
expect(rendered).to have_selector("a[id=maj_infos][href='/dossiers/#{dossier_id}/modifier']")
|
expect(rendered).to have_selector("a[id=maj_infos][href='/dossiers/#{dossier_id}/brouillon']")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue