Merge branch 'develop' into staging

This commit is contained in:
Xavier J 2016-12-19 19:08:10 +01:00
commit 56e7508079
35 changed files with 252 additions and 109 deletions

View file

@ -91,7 +91,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
NotificationMailer.dossier_received(@facade.dossier).deliver_now! NotificationMailer.dossier_received(@facade.dossier).deliver_now!
render 'show' redirect_to backoffice_dossier_path(id: @facade.dossier.id)
end end
def refuse def refuse
@ -102,7 +102,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
NotificationMailer.dossier_refused(@facade.dossier).deliver_now! NotificationMailer.dossier_refused(@facade.dossier).deliver_now!
render 'show' redirect_to backoffice_dossier_path(id: @facade.dossier.id)
end end
def without_continuation def without_continuation
@ -113,7 +113,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
NotificationMailer.dossier_without_continuation(@facade.dossier).deliver_now! NotificationMailer.dossier_without_continuation(@facade.dossier).deliver_now!
render 'show' redirect_to backoffice_dossier_path(id: @facade.dossier.id)
end end
def close def close
@ -124,7 +124,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
NotificationMailer.dossier_closed(@facade.dossier).deliver_now! NotificationMailer.dossier_closed(@facade.dossier).deliver_now!
render 'show' redirect_to backoffice_dossier_path(id: @facade.dossier.id)
end end
def follow def follow

View file

@ -4,9 +4,11 @@ class RootController < ApplicationController
if user_signed_in? && !route[:controller].match('users').nil? if user_signed_in? && !route[:controller].match('users').nil?
return redirect_to users_dossiers_path return redirect_to users_dossiers_path
end
if gestionnaire_signed_in? elsif administrateur_signed_in? && !route[:controller].match('admin').nil?
return redirect_to admin_procedures_path
elsif gestionnaire_signed_in?
procedure_id = current_gestionnaire.procedure_filter procedure_id = current_gestionnaire.procedure_filter
if procedure_id.nil? if procedure_id.nil?
procedure_list = current_gestionnaire.procedures procedure_list = current_gestionnaire.procedures
@ -16,7 +18,10 @@ class RootController < ApplicationController
else else
flash.alert = "Vous n'avez aucune procédure d'affectée" flash.alert = "Vous n'avez aucune procédure d'affectée"
end end
else
return redirect_to backoffice_dossiers_procedure_path(id: procedure_id)
end end
elsif user_signed_in? elsif user_signed_in?
return redirect_to users_dossiers_path return redirect_to users_dossiers_path
@ -25,7 +30,6 @@ class RootController < ApplicationController
elsif administration_signed_in? elsif administration_signed_in?
return redirect_to administrations_path return redirect_to administrations_path
end end
# @latest_release = Github::Releases.latest # @latest_release = Github::Releases.latest

View file

@ -32,7 +32,7 @@ class Users::CarteController < UsersController
end end
def get_position def get_position
point = Carto::Geocodeur.convert_adresse_to_point(current_user_dossier.etablissement.geo_adresse) point = Carto::Geocodeur.convert_adresse_to_point(current_user_dossier.etablissement.geo_adresse) rescue nil
lon = '2.428462' lon = '2.428462'
lat = '46.538192' lat = '46.538192'

View file

@ -1,6 +1,4 @@
.row.white-back .row.white-back
= render partial: 'admin/procedures/head', locals: {active: 'Accompagnateurs'}
#accompagnateur_form #accompagnateur_form
.row .row
.col-md-6.col-lg-6 .col-md-6.col-lg-6

View file

@ -1,6 +1,4 @@
.row.white-back .row.white-back
= render partial: 'admin/procedures/head', locals: {active: 'E-mails'}
%h3 %h3
E-mail d'accusé de réception E-mail d'accusé de réception

View file

@ -1,5 +1,3 @@
.row.white-back .row.white-back
= render partial: 'admin/procedures/head', locals: {active: 'Pieces'}
#piece_justificative_form #piece_justificative_form
= render 'form' = render 'form'

View file

@ -1,5 +1,3 @@
.row.white-back .row.white-back
= render partial: 'admin/procedures/head', locals: {active: 'Prévisualisation'}
#previsualisation #previsualisation
= render 'users/description/show' = render 'users/description/show'

View file

@ -1,8 +0,0 @@
%h2.text-info
-unless @procedure.logo.blank?
= image_tag @procedure.decorate.logo_img, style: 'width: 30px'
=@procedure.libelle
%br
%ul.nav.nav-tabs
= render partial: 'admin/procedures/navbar', locals: {active: active}

View file

@ -1,27 +0,0 @@
%li{ class: ('active' if active == 'Informations') }
= link_to 'Informations', admin_procedure_path(@procedure), id: 'onglet-infos'
%li{ class: ('active' if active == 'Accompagnateurs') }
= link_to t('dynamics.admin.procedure.onglets.accompagnateurs'), admin_procedure_accompagnateurs_path(@procedure), id: 'onglet-accompagnateurs'
%li{ class: ('disabled' if @procedure.locked?) || ('active' if active == 'Description') }
= link_to_unless(@procedure.locked?, 'Description', edit_admin_procedure_path(@procedure), id: 'onglet-description') do
= link_to 'Description', '#', id: 'onglet-description'
%li{ class: ('disabled' if @procedure.locked?) || ('active' if active == 'Champs') }
= link_to_unless(@procedure.locked?, 'Champs', admin_procedure_types_de_champ_path(@procedure), id: 'onglet-champs') do
= link_to 'Champs', '#', id: 'onglet-champs'
%li{ class: ('disabled' if @procedure.locked?) || ('active' if active == 'Pieces') }
= link_to_unless(@procedure.locked?, 'Pièces justificatives', admin_procedure_pieces_justificatives_path(@procedure), id: 'onglet-pieces') do
= link_to 'Pièces justificatives', '#', id: 'onglet-pieces'
%li{ class: ('disabled' if @procedure.locked?) || ('active' if active == 'Champs privés') }
= link_to_unless(@procedure.locked?, 'Champs privés', admin_procedure_types_de_champ_private_path(@procedure), id: 'onglet-private-champs') do
= link_to 'Champs privés', '#', id: 'onglet-private-champs'
%li{ class: ('active' if active == 'E-mails') }
= link_to 'E-mails', admin_procedure_mails_path(@procedure), id: 'onglet-emails'
%li{ class: ('active' if active == 'Prévisualisation'), style: 'float:right' }
= link_to 'Prévisualisation', admin_procedure_previsualisation_path(@procedure), id: 'onglet-preview'

View file

@ -1,6 +1,4 @@
.row.white-back .row.white-back
= render partial: 'head', locals: {active: 'Description'}
#procedure_new.section.section-label #procedure_new.section.section-label
= form_for @procedure, url: url_for({controller: 'admin/procedures', action: :update, id: @procedure.id}), multipart: true do |f| = form_for @procedure, url: url_for({controller: 'admin/procedures', action: :update, id: @procedure.id}), multipart: true do |f|
= render partial: 'informations', locals: {f: f} = render partial: 'informations', locals: {f: f}

View file

@ -1,7 +1,5 @@
.row.white-back .row.white-back
#procedure_show #procedure_show
= render partial: 'head', locals: {active: 'Informations'}
-unless @facade.procedure.published? -unless @facade.procedure.published?
- if @facade.procedure.gestionnaires.size == 0 - if @facade.procedure.gestionnaires.size == 0
%a.action_button.btn.btn-success{style:'float: right; margin-top: 10px', disabled: 'disabled', 'data-toggle' => :tooltip, title: 'Vous ne pouvez pas publier une procédure sans qu\'aucun accompagnateur ne soit affecté à celle-ci.', id: 'publish-procedure'} %a.action_button.btn.btn-success{style:'float: right; margin-top: 10px', disabled: 'disabled', 'data-toggle' => :tooltip, title: 'Vous ne pouvez pas publier une procédure sans qu\'aucun accompagnateur ne soit affecté à celle-ci.', id: 'publish-procedure'}

View file

@ -1,5 +1,3 @@
.row.white-back .row.white-back
= render partial: 'admin/procedures/head', locals: {active: @types_de_champ_facade.active}
#liste_champ #liste_champ
= render partial: 'admin/types_de_champ/form' = render partial: 'admin/types_de_champ/form'

View file

@ -22,7 +22,7 @@
%textarea.form-control{id: 'texte_commentaire', class: 'wysihtml5', name: 'texte_commentaire', style: 'width: 100%; margin-bottom:2%', rows: '5', placeholder:"Commentaire"} %textarea.form-control{id: 'texte_commentaire', class: 'wysihtml5', name: 'texte_commentaire', style: 'width: 100%; margin-bottom:2%', rows: '5', placeholder:"Commentaire"}
%h4.text-primary{style: 'margin-top: 0px'} Ajouter un fichier %h4.text-primary{style: 'margin-top: 0px'} Ajouter un fichier
= file_field_tag "piece_justificative[content]", accept: PieceJustificative.accept_format, style: 'float: left; margin-left: 20px' = file_field_tag "piece_justificative[content]", accept: PieceJustificative.accept_format, style: 'float: left; margin-left: 20px'
%input.form-control.btn.btn-send{ type: 'submit', value: 'ENVOYER' } %input#save-message.form-control.btn.btn-send{ type: 'submit', value: 'ENVOYER' }
- if last_comment = @facade.commentaires.first - if last_comment = @facade.commentaires.first
%div.last-commentaire %div.last-commentaire
.row .row
@ -40,13 +40,13 @@
= file.original_filename = file.original_filename
.row .row
.col-lg-12.col-md-12 .col-lg-12.col-md-12
%div.new-action %div#open-message.new-action
ENVOYER UN MESSAGE ENVOYER UN MESSAGE
- else - else
.last-commentaire .last-commentaire
.row .row
.col-lg-12.col-md-12 .col-lg-12.col-md-12
%div.new-action %div#open-message.new-action
ENVOYER UN MESSAGE ENVOYER UN MESSAGE
- if @facade.procedure.individual_with_siret - if @facade.procedure.individual_with_siret

View file

@ -1,5 +1,5 @@
- unless @facade.dossier.read_only? - unless @facade.dossier.read_only?
- if user_signed_in? && (@facade.dossier.owner?(current_user.email) || @facade.dossier.invite_by_user?(current_user.email)) - if user_signed_in? && (@facade.dossier.owner?(current_user.email) || @facade.dossier.invite_by_user?(current_user.email))
%a#maj_infos.action{href: "/users/dossiers/#{@facade.dossier.id}/description"} %a#maj_infos.action{href: "/users/dossiers/#{@facade.dossier.id}/description"}
%div.col-lg-2.col-md-2.action %div#edit-dossier.col-lg-2.col-md-2.action
= "éditer".upcase = "éditer".upcase

View file

@ -44,7 +44,7 @@
- else - else
%div.col-md-1.col-lg-1.comments-off %div.col-md-1.col-lg-1.comments-off
= "-" = "-"
%div.col-md-5.col-lg-5.depositaire-info %div.col-md-5.col-lg-5.depositaire-info{ id: "champ-#{champ.id}-value" }
- unless champ.decorate.value.blank? - unless champ.decorate.value.blank?
= champ.decorate.value.html_safe = champ.decorate.value.html_safe

View file

@ -20,7 +20,7 @@
.form-group.form-group-lg .form-group.form-group-lg
= f.text_field :siret, class: "form-control", placeholder: "Entrez votre Siret", value: @siret = f.text_field :siret, class: "form-control", placeholder: "Entrez votre Siret", value: @siret
= f.hidden_field :dossier_id, value: @facade.dossier.id = f.hidden_field :dossier_id, value: @facade.dossier.id
= f.submit 'Valider', class: %w(btn btn-lg btn-success), data: { disable_with: "Recherche en cours ..." } = f.submit 'Valider', class: %w(btn btn-lg btn-success), id: 'submit-siret', data: { disable_with: "Recherche en cours ..." }
- else - else
%br %br
#recap_info_entreprise #recap_info_entreprise

View file

@ -0,0 +1 @@
= render partial: 'layouts/left_panels/left_panel_admin_procedurescontroller_navbar', locals: {active: 'Accompagnateurs'}

View file

@ -0,0 +1 @@
= render partial: 'layouts/left_panels/left_panel_admin_procedurescontroller_navbar', locals: {active: 'E-mails'}

View file

@ -0,0 +1 @@
= render partial: 'layouts/left_panels/left_panel_admin_procedurescontroller_navbar', locals: {active: 'Pieces'}

View file

@ -0,0 +1 @@
= render partial: 'layouts/left_panels/left_panel_admin_procedurescontroller_navbar', locals: {active: 'Prévisualisation'}

View file

@ -0,0 +1 @@
= render partial: 'layouts/left_panels/left_panel_admin_procedurescontroller_navbar', locals: {active: 'Description'}

View file

@ -0,0 +1,53 @@
%div#first-block
%div.en-cours
-unless @procedure.logo.blank?
= image_tag @procedure.decorate.logo_img, style: 'width: 30px'
%b
=@procedure.libelle
%div#action-block
%div#menu-block
%div.split-hr-left
#procedure_list
%a{:href => "#{url_for admin_procedure_path(@procedure)}", id: 'onglet-infos'}
%div.procedure_list_element{class: ('active' if active == 'Informations')}
Informations
%a{:href => "#{url_for admin_procedure_accompagnateurs_path(@procedure)}", id: 'onglet-accompagnateurs'}
%div.procedure_list_element{class: ('active' if active == 'Accompagnateurs')}
=t('dynamics.admin.procedure.onglets.accompagnateurs')
- unless @procedure.locked?
%a{:href => "#{url_for edit_admin_procedure_path(@procedure)}", id: 'onglet-description'}
%div.procedure_list_element{class: ('active' if active == 'Description')}
Description
- unless @procedure.locked?
%a{:href => "#{url_for admin_procedure_types_de_champ_path(@procedure)}", id: 'onglet-champs'}
%div.procedure_list_element{class: ('active' if active == 'Champs')}
Champs
- unless @procedure.locked?
%a{:href => "#{url_for admin_procedure_pieces_justificatives_path(@procedure)}", id: 'onglet-pieces'}
%div.procedure_list_element{class: ('active' if active == 'Pieces')}
Pièces justificatives
- unless @procedure.locked?
%a{:href => "#{url_for admin_procedure_types_de_champ_private_path(@procedure)}", id: 'onglet-private-champs'}
%div.procedure_list_element{class: ('active' if active == 'Champs privés')}
Champs privés
%a{:href => "#{url_for admin_procedure_mails_path(@procedure)}", id: 'onglet-inemailsfos'}
%div.procedure_list_element{class: ('active' if active == 'E-mails')}
E-mails
%a{:href => "#{url_for admin_procedure_previsualisation_path(@procedure)}", id: 'onglet-preview'}
%div.procedure_list_element{class: ('active' if active == 'Prévisualisation')}
Prévisualisation
%div.split-hr-left
%div#infos-block

View file

@ -0,0 +1 @@
= render partial: 'layouts/left_panels/left_panel_admin_procedurescontroller_navbar', locals: {active: 'Informations'}

View file

@ -0,0 +1 @@
= render partial: 'layouts/left_panels/left_panel_admin_procedurescontroller_navbar', locals: {active: @types_de_champ_facade.active}

View file

@ -0,0 +1 @@
= render partial: 'layouts/left_panels/left_panel_admin_procedurescontroller_navbar', locals: {active: "Champs privés"}

View file

@ -11,37 +11,37 @@
%div.split-hr-left %div.split-hr-left
#procedure_list #procedure_list
%a{:href => "#{url_for users_dossiers_path(liste: 'brouillon')}", 'data-toggle' => :tooltip, title: 'Les dossiers jamais proposés à la relecture.'} %a{:href => "#{url_for users_dossiers_path(liste: 'brouillon')}", 'data-toggle' => :tooltip, title: 'Les dossiers jamais proposés à la relecture.'}
%div.procedure_list_element{ class: @dossiers_list_facade.brouillon_class } %div.procedure_list_element{ class: @dossiers_list_facade.brouillon_class, id: 'brouillon' }
= "Brouillons" = "Brouillons"
.badge.progress-bar-default .badge.progress-bar-default
= @dossiers_list_facade.brouillon_total = @dossiers_list_facade.brouillon_total
%a{:href => "#{url_for users_dossiers_path(liste: 'a_traiter')}", 'data-toggle' => :tooltip, title: 'Les dossiers qui requièrent une action de votre part.'} %a{:href => "#{url_for users_dossiers_path(liste: 'a_traiter')}", 'data-toggle' => :tooltip, title: 'Les dossiers qui requièrent une action de votre part.'}
%div.procedure_list_element{ class: @dossiers_list_facade.en_construction_class } %div.procedure_list_element{ class: @dossiers_list_facade.en_construction_class, id: 'a_traiter' }
= "En construction" = "En construction"
.badge.progress-bar-danger .badge.progress-bar-danger
= @dossiers_list_facade.en_construction_total = @dossiers_list_facade.en_construction_total
%a{:href => "#{url_for users_dossiers_path(liste: 'valides')}", 'data-toggle' => :tooltip, title: 'Les dossiers relus par votre accompagnateur pouvant être déposés pour examen.'} %a{:href => "#{url_for users_dossiers_path(liste: 'valides')}", 'data-toggle' => :tooltip, title: 'Les dossiers relus par votre accompagnateur pouvant être déposés pour examen.'}
%div.procedure_list_element{ class: @dossiers_list_facade.valides_class } %div.procedure_list_element{ class: @dossiers_list_facade.valides_class, id: 'valides' }
="À déposer" ="À déposer"
.badge.progress-bar-purple .badge.progress-bar-purple
= @dossiers_list_facade.valides_total = @dossiers_list_facade.valides_total
%a{:href => "#{url_for users_dossiers_path(liste: 'en_instruction')}", 'data-toggle' => :tooltip, title: 'Les dossiers en cours d\'examen par l\'administration compétante.'} %a{:href => "#{url_for users_dossiers_path(liste: 'en_instruction')}", 'data-toggle' => :tooltip, title: 'Les dossiers en cours d\'examen par l\'administration compétante.'}
%div.procedure_list_element{ class: @dossiers_list_facade.en_instruction_class } %div.procedure_list_element{ class: @dossiers_list_facade.en_instruction_class, id: 'en_instruction' }
="En examen" ="En examen"
.badge.progress-bar-default .badge.progress-bar-default
= @dossiers_list_facade.en_instruction_total = @dossiers_list_facade.en_instruction_total
%a{:href => "#{url_for users_dossiers_path(liste: 'termine')}", 'data-toggle' => :tooltip, title: 'Les dossiers cloturés qui peuvent être "Accepté", "Refusé" ou "Sans suite".'} %a{:href => "#{url_for users_dossiers_path(liste: 'termine')}", 'data-toggle' => :tooltip, title: 'Les dossiers cloturés qui peuvent être "Accepté", "Refusé" ou "Sans suite".'}
%div.procedure_list_element{ class: @dossiers_list_facade.termine_class } %div.procedure_list_element{ class: @dossiers_list_facade.termine_class, id: 'termine' }
= "Cloturé" = "Cloturé"
.badge.progress-bar-success .badge.progress-bar-success
= @dossiers_list_facade.termine_total = @dossiers_list_facade.termine_total
%a{:href => "#{url_for users_dossiers_path(liste: 'invite')}"} %a{:href => "#{url_for users_dossiers_path(liste: 'invite')}"}
%div.procedure_list_element{ class: @dossiers_list_facade.invite_class } %div.procedure_list_element{ class: @dossiers_list_facade.invite_class, id: 'invite' }
= "Invitation" = "Invitation"
.badge.progress-bar-warning .badge.progress-bar-warning
= @dossiers_list_facade.invite_total = @dossiers_list_facade.invite_total

View file

@ -47,7 +47,8 @@
Vous pourrez dans tous les cas les compléter plus tard si vous ne les possédez pas de suite. Vous pourrez dans tous les cas les compléter plus tard si vous ne les possédez pas de suite.
- if user_signed_in? -route = Rails.application.routes.recognize_path(request.referrer)
- unless route[:controller].match('admin')
%div{style: 'text-align:right'} %div{style: 'text-align:right'}
%h6 Tous les champs portant un * sont obligatoires. %h6 Tous les champs portant un * sont obligatoires.

View file

@ -155,6 +155,8 @@ describe Backoffice::DossiersController, type: :controller do
subject subject
end end
it { is_expected.to redirect_to backoffice_dossier_path(id: dossier.id) }
end end
describe 'POST #receive' do describe 'POST #receive' do
@ -182,6 +184,8 @@ describe Backoffice::DossiersController, type: :controller do
subject subject
end end
it { is_expected.to redirect_to backoffice_dossier_path(id: dossier.id) }
end end
describe 'POST #refuse' do describe 'POST #refuse' do
@ -205,6 +209,8 @@ describe Backoffice::DossiersController, type: :controller do
subject subject
end end
it { is_expected.to redirect_to backoffice_dossier_path(id: dossier.id) }
end end
describe 'POST #without_continuation' do describe 'POST #without_continuation' do
@ -228,6 +234,8 @@ describe Backoffice::DossiersController, type: :controller do
subject subject
end end
it { is_expected.to redirect_to backoffice_dossier_path(id: dossier.id) }
end end
describe 'POST #close' do describe 'POST #close' do
@ -250,6 +258,8 @@ describe Backoffice::DossiersController, type: :controller do
subject subject
end end
it { is_expected.to redirect_to backoffice_dossier_path(id: dossier.id) }
end end
describe 'PUT #toggle_follow' do describe 'PUT #toggle_follow' do

View file

@ -22,6 +22,12 @@ FactoryGirl.define do
end end
end end
trait :for_individual do
after(:build) do |procedure, _evaluator|
procedure.for_individual = true
end
end
trait :with_type_de_champ do trait :with_type_de_champ do
after(:build) do |procedure, _evaluator| after(:build) do |procedure, _evaluator|
type_de_champ = create(:type_de_champ_public) type_de_champ = create(:type_de_champ_public)

View file

@ -17,43 +17,44 @@ feature 'procedure locked' do
end end
end end
context 'when procedure is published' do context 'when procedure is published' do
let(:published) { true } pending 'à voir si on enlève complètement les référence dans le left panel ou pas'
before do # let(:published) { true }
visit admin_procedure_path(procedure) # before do
end # visit admin_procedure_path(procedure)
# end
scenario 'info label is present' do #
expect(page).to have_content('La procédure ne peut plus être modifiée car elle a été publiée') # scenario 'info label is present' do
end # expect(page).to have_content('La procédure ne peut plus être modifiée car elle a été publiée')
# end
context 'when user click on Description tab' do #
before do # context 'when user click on Description tab' do
page.click_on 'Description' # before do
end # page.click_on 'Description'
# end
scenario 'page doest not change' do #
expect(page).to have_css('#procedure_show') # scenario 'page doest not change' do
end # expect(page).to have_css('#procedure_show')
end # end
# end
context 'when user click on Champs tab' do #
before do # context 'when user click on Champs tab' do
page.click_on 'Champs' # before do
end # page.click_on 'Champs'
# end
scenario 'page doest not change' do #
expect(page).to have_css('#procedure_show') # scenario 'page doest not change' do
end # expect(page).to have_css('#procedure_show')
end # end
# end
context 'when user click on Pieces Justificatives tab' do #
before do # context 'when user click on Pieces Justificatives tab' do
page.click_on 'Pièces justificatives' # before do
end # page.click_on 'Pièces justificatives'
# end
scenario 'page doest not change' do #
expect(page).to have_css('#procedure_show') # scenario 'page doest not change' do
end # expect(page).to have_css('#procedure_show')
end # end
# end
end end
end end

View file

@ -0,0 +1,53 @@
require 'spec_helper'
feature 'As a User I wanna create a dossier', js: true do
let(:user) { create(:user) }
let(:siret) { '40307130100044' }
let(:siren) { siret[0...9] }
context 'Right after sign_in I shall see inscription by credentials/siret, I can create a new Dossier' do
let(:procedure_with_siret) { create(:procedure, :published, :with_api_carto, :with_type_de_champ, :with_two_type_de_piece_justificative) }
let(:procedure_for_individual) { create(:procedure, :published, :for_individual, :with_api_carto, :with_type_de_champ, :with_two_type_de_piece_justificative) }
scenario 'Identification for individual' do
login_as user, scope: :user
visit commencer_path(procedure_path: procedure_for_individual.path)
fill_in 'dossier_individual_attributes_nom', with: 'Nom'
fill_in 'dossier_individual_attributes_prenom', with: 'Prenom'
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
page.find_by_id('etape_suivante').click
expect(page).to have_current_path(users_dossier_carte_path(Dossier.first.id.to_s), only_path: true)
page.find_by_id('etape_suivante').click
fill_in 'champs_1', with: 'contenu du champ 1'
page.find_by_id('suivant').click
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
end
scenario 'Identification through siret' do
login_as user, scope: :user
visit commencer_path(procedure_path: procedure_with_siret.path)
expect(page).to have_current_path(users_dossier_path(Dossier.first.id.to_s), only_path: true)
fill_in 'dossier_siret', with: siret
stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
stub_request(:get, "https://api-dev.apientreprise.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}")
.to_return(status: 200, body: File.read('spec/support/files/entreprise.json'))
stub_request(:get, "https://api-dev.apientreprise.fr/v1/etablissements/exercices/#{siret}?token=#{SIADETOKEN}")
.to_return(status: 200, body: File.read('spec/support/files/exercices.json'))
stub_request(:get, "https://api-dev.apientreprise.fr/v1/associations/#{siret}?token=#{SIADETOKEN}")
.to_return(status: 404, body: '')
page.find_by_id('dossier_siret').set siret
page.find_by_id('submit-siret').click
expect(page).to have_css('#recap_info_entreprise')
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
page.find_by_id('etape_suivante').click
expect(page).to have_current_path(users_dossier_carte_path(Dossier.first.id.to_s), only_path: true)
page.find_by_id('etape_suivante').click
fill_in 'champs_1', with: 'contenu du champ 1'
page.find_by_id('suivant').click
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
end
end
end

View file

@ -0,0 +1,52 @@
require 'spec_helper'
feature 'As a User I want to edit a dossier I own', js: true do
let(:user) { create(:user) }
let(:procedure_for_individual) { create(:procedure, :published, :for_individual, :with_api_carto, :with_type_de_champ, :with_two_type_de_piece_justificative) }
before "Create dossier" do
login_as user, scope: :user
visit commencer_path(procedure_path: procedure_for_individual.path)
fill_in 'dossier_individual_attributes_nom', with: 'Nom'
fill_in 'dossier_individual_attributes_prenom', with: 'Prenom'
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
page.find_by_id('etape_suivante').click
page.find_by_id('etape_suivante').click
page.find_by_id('suivant').click
visit root_path
end
context 'After sign_in, I can navigate through dossiers indexes and edit a dossier' do
scenario 'After sign_in, I can see dossiers "à traiter" (default), and other indexes' do
expect(page.find('#a_traiter')['class'] ).to eq('active procedure_list_element')
page.find_by_id('brouillon').click
page.find_by_id('a_traiter').click
page.find_by_id('valides').click
page.find_by_id('en_instruction').click
page.find_by_id('termine').click
page.find_by_id('invite').click
end
scenario 'Getting a dossier, I want to create a new message on' do
page.find_by_id('tr_dossier_' + Dossier.last.id.to_s).click
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
page.find_by_id('open-message').click
page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')")
page.find_by_id('save-message').click
expect(page.find('.last-commentaire .content').text).to eq('Contenu du nouveau message')
end
scenario 'On the same dossier, I want to edit informations' do
page.find_by_id('tr_dossier_' + Dossier.last.id.to_s).click
page.find_by_id('edit-dossier').click
expect(page).to have_current_path(users_dossier_description_path(Dossier.first.id.to_s), only_path: true)
fill_in 'champs_1', with: 'Contenu du champ 1'
page.find_by_id('modification_terminee').click
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
expect(page.find('#champ-1-value').text).to eq('Contenu du champ 1')
end
end
end

0
spec/fixtures/file.pdf vendored Normal file
View file

View file

@ -1,6 +1,10 @@
require 'spec_helper' require 'spec_helper'
describe 'admin/previsualisations/show.html.haml', type: :view do describe 'admin/previsualisations/show.html.haml', type: :view do
before do
@request.env['HTTP_REFERER'] = admin_procedures_url
end
let(:user) { create(:user) } let(:user) { create(:user) }
let(:cerfa_flag) { true } let(:cerfa_flag) { true }
let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, cerfa_flag: cerfa_flag) } let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, cerfa_flag: cerfa_flag) }