Merge branch 'develop' into staging
This commit is contained in:
commit
6d2650cee2
20 changed files with 166 additions and 33 deletions
4
Gemfile
4
Gemfile
|
@ -109,8 +109,8 @@ group :test do
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
gem 'terminal-notifier'
|
# gem 'terminal-notifier'
|
||||||
gem 'terminal-notifier-guard'
|
# gem 'terminal-notifier-guard'
|
||||||
|
|
||||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||||
gem 'byebug'
|
gem 'byebug'
|
||||||
|
|
|
@ -561,8 +561,6 @@ GEM
|
||||||
i18n
|
i18n
|
||||||
json (>= 1.4.3)
|
json (>= 1.4.3)
|
||||||
temple (0.7.6)
|
temple (0.7.6)
|
||||||
terminal-notifier (1.6.3)
|
|
||||||
terminal-notifier-guard (1.6.4)
|
|
||||||
terminal-table (1.5.2)
|
terminal-table (1.5.2)
|
||||||
therubyracer (0.12.2)
|
therubyracer (0.12.2)
|
||||||
libv8 (~> 3.16.14.0)
|
libv8 (~> 3.16.14.0)
|
||||||
|
@ -683,8 +681,6 @@ DEPENDENCIES
|
||||||
smart_listing
|
smart_listing
|
||||||
spring
|
spring
|
||||||
spring-commands-rspec
|
spring-commands-rspec
|
||||||
terminal-notifier
|
|
||||||
terminal-notifier-guard
|
|
||||||
therubyracer
|
therubyracer
|
||||||
timecop
|
timecop
|
||||||
turbolinks
|
turbolinks
|
||||||
|
|
|
@ -22,7 +22,6 @@ function path_modal_action() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function path_validation_action() {
|
function path_validation_action() {
|
||||||
$("input[id='procedure_path']").keyup(function (key) {
|
$("input[id='procedure_path']").keyup(function (key) {
|
||||||
if (key.keyCode != 13)
|
if (key.keyCode != 13)
|
||||||
|
@ -58,7 +57,6 @@ function validatePath(path) {
|
||||||
return re.test(path);
|
return re.test(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function path_type_init() {
|
function path_type_init() {
|
||||||
display = 'label';
|
display = 'label';
|
||||||
|
|
||||||
|
@ -89,3 +87,12 @@ function path_type_init() {
|
||||||
togglePathMessage(true, suggestion['mine']);
|
togglePathMessage(true, suggestion['mine']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function transfer_errors_message(show) {
|
||||||
|
if(show){
|
||||||
|
$("#not_found_admin").slideDown(100)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#not_found_admin").slideUp(100)
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,9 +7,9 @@ class Admin::ProceduresController < AdminController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@procedures = smart_listing_create :procedures,
|
@procedures = smart_listing_create :procedures,
|
||||||
current_administrateur.procedures.where(published: true, archived: false).order(created_at: :desc),
|
current_administrateur.procedures.where(published: true, archived: false).order(created_at: :desc),
|
||||||
partial: "admin/procedures/list",
|
partial: "admin/procedures/list",
|
||||||
array: true
|
array: true
|
||||||
|
|
||||||
active_class
|
active_class
|
||||||
end
|
end
|
||||||
|
@ -36,7 +36,6 @@ class Admin::ProceduresController < AdminController
|
||||||
render 'index'
|
render 'index'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@facade = AdminProceduresShowFacades.new @procedure.decorate
|
@facade = AdminProceduresShowFacades.new @procedure.decorate
|
||||||
end
|
end
|
||||||
|
@ -122,6 +121,22 @@ class Admin::ProceduresController < AdminController
|
||||||
redirect_to admin_procedures_path
|
redirect_to admin_procedures_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def transfer
|
||||||
|
admin = Administrateur.find_by_email(params[:email_admin])
|
||||||
|
|
||||||
|
return render '/admin/procedures/transfer', formats: 'js', status: 404 if admin.nil?
|
||||||
|
|
||||||
|
procedure = current_administrateur.procedures.find(params[:procedure_id])
|
||||||
|
clone_procedure = procedure.clone
|
||||||
|
|
||||||
|
clone_procedure.administrateur = admin
|
||||||
|
clone_procedure.save
|
||||||
|
|
||||||
|
flash.now.notice = "La procédure a correctement été cloné vers le nouvel administrateur."
|
||||||
|
|
||||||
|
render '/admin/procedures/transfer', formats: 'js', status: 200
|
||||||
|
end
|
||||||
|
|
||||||
def archive
|
def archive
|
||||||
procedure = current_administrateur.procedures.find(params[:procedure_id])
|
procedure = current_administrateur.procedures.find(params[:procedure_id])
|
||||||
procedure.archive
|
procedure.archive
|
||||||
|
@ -165,8 +180,8 @@ class Admin::ProceduresController < AdminController
|
||||||
|
|
||||||
def path_list
|
def path_list
|
||||||
render json: ProcedurePath.where("path LIKE '%#{params[:request]}%'").pluck(:path, :administrateur_id).inject([]) {
|
render json: ProcedurePath.where("path LIKE '%#{params[:request]}%'").pluck(:path, :administrateur_id).inject([]) {
|
||||||
|acc, value| acc.push({ label: value.first, mine: value.second == current_administrateur.id })
|
|acc, value| acc.push({label: value.first, mine: value.second == current_administrateur.id})
|
||||||
}.to_json
|
}.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -59,12 +59,16 @@ class Users::DossiersController < UsersController
|
||||||
|
|
||||||
update_current_user_siret! siret
|
update_current_user_siret! siret
|
||||||
|
|
||||||
DossierService.new(@facade.dossier, siret, current_user.france_connect_information).dossier_informations!
|
dossier = DossierService.new(@facade.dossier, siret, current_user.france_connect_information).dossier_informations!
|
||||||
|
|
||||||
|
if dossier.entreprise.nil? || dossier.etablissement.nil?
|
||||||
|
return errors_valid_siret
|
||||||
|
end
|
||||||
|
|
||||||
@facade = facade params[:dossier_id]
|
@facade = facade params[:dossier_id]
|
||||||
render '/dossiers/new_siret', formats: 'js'
|
render '/dossiers/new_siret', formats: 'js'
|
||||||
|
|
||||||
rescue RestClient::ResourceNotFound
|
rescue RestClient::ResourceNotFound, RestClient::BadRequest
|
||||||
errors_valid_siret
|
errors_valid_siret
|
||||||
|
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
|
|
@ -202,4 +202,8 @@ class Dossier < ActiveRecord::Base
|
||||||
def total_follow
|
def total_follow
|
||||||
follows.size
|
follows.size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def total_commentaire
|
||||||
|
self.commentaires.size
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,4 +85,7 @@ class Procedure < ActiveRecord::Base
|
||||||
self.update_attributes!({ archived: true })
|
self.update_attributes!({ archived: true })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def total_dossier
|
||||||
|
self.dossiers.where.not(state: :draft).size
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,8 @@ class DossierSerializer < ActiveModel::Serializer
|
||||||
:updated_at,
|
:updated_at,
|
||||||
:archived,
|
:archived,
|
||||||
:mandataire_social,
|
:mandataire_social,
|
||||||
:state
|
:state,
|
||||||
|
:total_commentaire
|
||||||
|
|
||||||
has_one :entreprise
|
has_one :entreprise
|
||||||
has_one :etablissement
|
has_one :etablissement
|
||||||
|
|
|
@ -7,7 +7,8 @@ class ProcedureSerializer < ActiveModel::Serializer
|
||||||
:organisation,
|
:organisation,
|
||||||
:direction,
|
:direction,
|
||||||
:archived,
|
:archived,
|
||||||
:geographic_information
|
:geographic_information,
|
||||||
|
:total_dossier
|
||||||
|
|
||||||
|
|
||||||
has_one :geographic_information, serializer: ModuleApiCartoSerializer
|
has_one :geographic_information, serializer: ModuleApiCartoSerializer
|
||||||
|
|
23
app/views/admin/procedures/_modal_transfer.html.haml
Normal file
23
app/views/admin/procedures/_modal_transfer.html.haml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#transferModal.modal.fade{"aria-labelledby" => "TransferProcedureModal", :role => "dialog", :tabindex => "-1"}
|
||||||
|
.modal-dialog.modal-md{:role => "document"}
|
||||||
|
= form_tag admin_procedure_transfer_path(procedure_id: @procedure.id), method: :post, remote: true do
|
||||||
|
.modal-content
|
||||||
|
.modal-header
|
||||||
|
%button.close{"aria-label" => "Close", "data-dismiss" => "modal", :type => "button"}
|
||||||
|
%span{"aria-hidden" => "true"} ×
|
||||||
|
%h4#myModalLabel.modal-title
|
||||||
|
Petit transfert de procédure entre administrateur
|
||||||
|
.modal-body
|
||||||
|
%p
|
||||||
|
Cette fonctionnalité vous permet de transmettre un clone de votre procédure à un autre administrateur.
|
||||||
|
%div{style:'margin-top:20px'}
|
||||||
|
= text_field_tag :email_admin, '', {class: 'form-control',
|
||||||
|
type: 'email',
|
||||||
|
placeholder: 'Email administrateur cible',
|
||||||
|
maxlength: 30,
|
||||||
|
style: 'width: 300px; margin-left:auto; margin-right:auto'}
|
||||||
|
%div#not_found_admin.center.text-danger{style:'display:none; margin-top: 10px'}
|
||||||
|
Cet administrateur n'existe pas.
|
||||||
|
.modal-footer
|
||||||
|
= submit_tag "Envoyer", class: 'btn btn-success'
|
||||||
|
= button_tag 'Annuler', class: %w(btn btn btn-default), id: 'cancel', data: { dismiss: 'modal' }
|
|
@ -1,19 +1,26 @@
|
||||||
#procedure_show
|
#procedure_show
|
||||||
=render partial: 'head', locals: {active: 'Informations'}
|
=render partial: 'head', locals: {active: 'Informations'}
|
||||||
|
|
||||||
-if ! @facade.procedure.published?
|
-unless @facade.procedure.published?
|
||||||
%a#publish.btn.btn-success{"data-target" => "#publishModal", "data-toggle" => "modal", :type => "button", style:'float: right; margin-top: 10px'}
|
%a#publish.btn.btn-success{"data-target" => "#publishModal", "data-toggle" => "modal", :type => "button", style:'float: right; margin-top: 10px'}
|
||||||
%i.fa.fa-eraser
|
%i.fa.fa-eraser
|
||||||
Publier
|
Publier
|
||||||
%br
|
|
||||||
=render partial: '/admin/procedures/modal_publish'
|
=render partial: '/admin/procedures/modal_publish'
|
||||||
|
|
||||||
|
%a#transfer.btn.btn-small.btn-default{"data-target" => "#transferModal", "data-toggle" => "modal", :type => "button", style:'float: right; margin-top: 10px'}
|
||||||
|
%i.fa.fa-exchange
|
||||||
|
Transférer
|
||||||
|
|
||||||
|
=render partial: '/admin/procedures/modal_transfer'
|
||||||
|
|
||||||
-if @facade.procedure.archived?
|
-if @facade.procedure.archived?
|
||||||
%a#reenable.btn.btn-small.btn-default.text-info{"data-target" => "#publishModal", "data-toggle" => "modal", :type => "button", style:'float: right; margin-top: 10px'}
|
%a#reenable.btn.btn-small.btn-default.text-info{"data-target" => "#publishModal", "data-toggle" => "modal", :type => "button", style:'float: right; margin-top: 10px'}
|
||||||
%i.fa.fa-eraser
|
%i.fa.fa-eraser
|
||||||
Réactiver
|
Réactiver
|
||||||
%br
|
|
||||||
=render partial: '/admin/procedures/modal_publish'
|
=render partial: '/admin/procedures/modal_publish'
|
||||||
|
|
||||||
-elsif @facade.procedure.published?
|
-elsif @facade.procedure.published?
|
||||||
= form_tag admin_procedure_archive_path(procedure_id: @facade.procedure.id, archive: !@facade.procedure.archived?), method: :put, style:'float: right; margin-top: 10px' do
|
= form_tag admin_procedure_archive_path(procedure_id: @facade.procedure.id, archive: !@facade.procedure.archived?), method: :put, style:'float: right; margin-top: 10px' do
|
||||||
%button#archive.btn.btn-small.btn-default.text-info{type: :button}
|
%button#archive.btn.btn-small.btn-default.text-info{type: :button}
|
||||||
|
|
11
app/views/admin/procedures/transfer.js.erb
Normal file
11
app/views/admin/procedures/transfer.js.erb
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<%- if response.status == 404 %>
|
||||||
|
transfer_errors_message(true);
|
||||||
|
<%- else %>
|
||||||
|
<% flash.each do |type, message| %>
|
||||||
|
$("#flash_message").html("<div class=\"alert alert-success\"> <%= message.html_safe %></div>")
|
||||||
|
<% end %>
|
||||||
|
<% flash.clear %>
|
||||||
|
transfer_errors_message(false);
|
||||||
|
$("#email_admin").val('');
|
||||||
|
$("button#cancel").click();
|
||||||
|
<%- end %>
|
|
@ -2,12 +2,12 @@ Bienvenue sur la plateforme TPS
|
||||||
|
|
||||||
Nous vous remercions de vous être inscrit sur TPS. Pour mémoire, voici quelques informations utiles :
|
Nous vous remercions de vous être inscrit sur TPS. Pour mémoire, voici quelques informations utiles :
|
||||||
|
|
||||||
URL : https://tps.apientreprise.fr
|
URL : <%= root_url %>>
|
||||||
Login : <%= @user.email %>
|
Login : <%= @user.email %>
|
||||||
|
|
||||||
Oubli de mot de passe, pas de problème :
|
Oubli de mot de passe, pas de problème :
|
||||||
|
|
||||||
https://tps.apientreprise.fr/users/password/new
|
<%= new_user_password_url %>
|
||||||
|
|
||||||
Bonne journée,
|
Bonne journée,
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
put 'archive' => 'procedures#archive', as: :archive
|
put 'archive' => 'procedures#archive', as: :archive
|
||||||
put 'publish' => 'procedures#publish', as: :publish
|
put 'publish' => 'procedures#publish', as: :publish
|
||||||
|
post 'transfer' => 'procedures#transfer', as: :transfer
|
||||||
put 'clone' => 'procedures#clone', as: :clone
|
put 'clone' => 'procedures#clone', as: :clone
|
||||||
|
|
||||||
resource :accompagnateurs, only: [:show, :update]
|
resource :accompagnateurs, only: [:show, :update]
|
||||||
|
|
|
@ -77,7 +77,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
subject
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect { subject }.to change{Procedure.count}.by(-1) }
|
it { expect { subject }.to change { Procedure.count }.by(-1) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when procedure is published' do
|
context 'when procedure is published' do
|
||||||
|
@ -451,4 +451,31 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'POST transfer' do
|
||||||
|
let!(:procedure) { create :procedure, administrateur: admin }
|
||||||
|
|
||||||
|
subject { post :transfer, email_admin: email_admin, procedure_id: procedure.id }
|
||||||
|
|
||||||
|
context 'when admin is unknow' do
|
||||||
|
let(:email_admin) { 'plop' }
|
||||||
|
|
||||||
|
it { expect(subject.status).to eq 404 }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when admin is know' do
|
||||||
|
let(:new_admin) { create :administrateur, email: 'new_admin@admin.com' }
|
||||||
|
let(:email_admin) { new_admin.email }
|
||||||
|
|
||||||
|
it { expect(subject.status).to eq 200 }
|
||||||
|
it { expect {subject}.to change(Procedure, :count).by(1) }
|
||||||
|
|
||||||
|
context {
|
||||||
|
before do
|
||||||
|
subject
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(Procedure.last.administrateur).to eq new_admin }
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -115,7 +115,7 @@ describe API::V1::DossiersController do
|
||||||
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure) } }
|
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure) } }
|
||||||
let(:dossier_id) { dossier.id }
|
let(:dossier_id) { dossier.id }
|
||||||
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
|
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
|
||||||
let(:field_list) { [:id, :created_at, :updated_at, :archived, :mandataire_social, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :commentaires, :state] }
|
let(:field_list) { [:id, :created_at, :updated_at, :archived, :mandataire_social, :total_commentaire, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :commentaires, :state] }
|
||||||
subject { body[:dossier] }
|
subject { body[:dossier] }
|
||||||
|
|
||||||
it 'return REST code 200', :show_in_doc do
|
it 'return REST code 200', :show_in_doc do
|
||||||
|
@ -127,6 +127,7 @@ describe API::V1::DossiersController do
|
||||||
it { expect(subject[:updated_at]).to eq('2008-09-01T08:05:00.000Z') }
|
it { expect(subject[:updated_at]).to eq('2008-09-01T08:05:00.000Z') }
|
||||||
it { expect(subject[:archived]).to eq(dossier.archived) }
|
it { expect(subject[:archived]).to eq(dossier.archived) }
|
||||||
it { expect(subject[:mandataire_social]).to eq(dossier.mandataire_social) }
|
it { expect(subject[:mandataire_social]).to eq(dossier.mandataire_social) }
|
||||||
|
it { expect(subject[:total_commentaire]).to eq(dossier.total_commentaire) }
|
||||||
|
|
||||||
it { expect(subject.keys).to match_array(field_list) }
|
it { expect(subject.keys).to match_array(field_list) }
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ describe API::V1::ProceduresController do
|
||||||
it { expect(subject[:direction]).to eq(procedure.direction) }
|
it { expect(subject[:direction]).to eq(procedure.direction) }
|
||||||
it { expect(subject[:link]).to eq(procedure.lien_demarche) }
|
it { expect(subject[:link]).to eq(procedure.lien_demarche) }
|
||||||
it { expect(subject[:archived]).to eq(procedure.archived) }
|
it { expect(subject[:archived]).to eq(procedure.archived) }
|
||||||
|
it { expect(subject[:total_dossier]).to eq(procedure.total_dossier) }
|
||||||
it { is_expected.to have_key(:types_de_champ) }
|
it { is_expected.to have_key(:types_de_champ) }
|
||||||
it { expect(subject[:types_de_champ]).to be_an(Array) }
|
it { expect(subject[:types_de_champ]).to be_an(Array) }
|
||||||
describe 'type_de_champ' do
|
describe 'type_de_champ' do
|
||||||
|
|
|
@ -160,15 +160,17 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST #siret_informations' do
|
describe 'POST #siret_informations' do
|
||||||
|
let(:user) { create(:user) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret_not_found}?token=#{SIADETOKEN}")
|
stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret_not_found}?token=#{SIADETOKEN}")
|
||||||
.to_return(status: 404, body: 'fake body')
|
.to_return(status: 404, body: 'fake body')
|
||||||
|
|
||||||
stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
|
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'))
|
.to_return(status: status_entreprise_call, body: File.read('spec/support/files/etablissement.json'))
|
||||||
|
|
||||||
stub_request(:get, "https://api-dev.apientreprise.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}")
|
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'))
|
.to_return(status: status_entreprise_call, body: File.read('spec/support/files/entreprise.json'))
|
||||||
|
|
||||||
stub_request(:get, "https://api-dev.apientreprise.fr/v1/etablissements/exercices/#{siret}?token=#{SIADETOKEN}")
|
stub_request(:get, "https://api-dev.apientreprise.fr/v1/etablissements/exercices/#{siret}?token=#{SIADETOKEN}")
|
||||||
.to_return(status: exercices_status, body: exercices_body)
|
.to_return(status: exercices_status, body: exercices_body)
|
||||||
|
@ -180,8 +182,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'dossier attributs' do
|
describe 'dossier attributs' do
|
||||||
let(:user) { create(:user) }
|
let(:status_entreprise_call) { 200 }
|
||||||
|
|
||||||
shared_examples 'with valid siret' do
|
shared_examples 'with valid siret' do
|
||||||
before do
|
before do
|
||||||
sign_in user
|
sign_in user
|
||||||
|
@ -322,6 +323,20 @@ describe Users::DossiersController, type: :controller do
|
||||||
it { expect(response.to_a[2]).to be_an_instance_of ActionDispatch::Response::RackBody }
|
it { expect(response.to_a[2]).to be_an_instance_of ActionDispatch::Response::RackBody }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when REST error 400 is return' do
|
||||||
|
let(:status_entreprise_call) { 400 }
|
||||||
|
|
||||||
|
subject { post :siret_informations, dossier_id: dossier.id, dossier: {siret: siret} }
|
||||||
|
|
||||||
|
before do
|
||||||
|
sign_in user
|
||||||
|
subject
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(response.status).to eq 200 }
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'PUT #update' do
|
describe 'PUT #update' do
|
||||||
|
|
|
@ -4,8 +4,8 @@ describe WelcomeMailer, type: :mailer do
|
||||||
describe ".welcome_email" do
|
describe ".welcome_email" do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
subject(:subject) { described_class.welcome_email(user) }
|
subject(:subject) { described_class.welcome_email(user) }
|
||||||
it { expect(subject.body).to match('https://tps.apientreprise.fr') }
|
it { expect(subject.body).to match(root_url) }
|
||||||
it { expect(subject.body).to match('https://tps.apientreprise.fr/users/password/new') }
|
it { expect(subject.body).to match(new_user_password_url) }
|
||||||
it { expect(subject.body).to match(user.email) }
|
it { expect(subject.body).to match(user.email) }
|
||||||
it { expect(subject.body).to match('Bienvenue sur la plateforme TPS') }
|
it { expect(subject.body).to match('Bienvenue sur la plateforme TPS') }
|
||||||
it { expect(subject.body).to match('Nous vous remercions de vous être inscrit sur TPS. Pour mémoire, voici quelques informations utiles :')}
|
it { expect(subject.body).to match('Nous vous remercions de vous être inscrit sur TPS. Pour mémoire, voici quelques informations utiles :')}
|
||||||
|
|
|
@ -200,4 +200,20 @@ describe Procedure do
|
||||||
expect(ProcedurePath.find_by_procedure_id(procedure.id)).to be_nil
|
expect(ProcedurePath.find_by_procedure_id(procedure.id)).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'total_dossier' do
|
||||||
|
|
||||||
|
let(:procedure) { create :procedure }
|
||||||
|
|
||||||
|
before do
|
||||||
|
create :dossier, procedure: procedure, state: :initiated
|
||||||
|
create :dossier, procedure: procedure, state: :draft
|
||||||
|
create :dossier, procedure: procedure, state: :replied
|
||||||
|
end
|
||||||
|
|
||||||
|
subject { procedure.total_dossier }
|
||||||
|
|
||||||
|
it { is_expected.to eq 2 }
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue