Clean some tests after removing :validated & :submitted states
This commit is contained in:
parent
cae5b37e38
commit
10add61bd1
21 changed files with 20 additions and 404 deletions
|
@ -17,18 +17,9 @@ class Users::RecapitulatifController < UsersController
|
|||
redirect_to users_dossier_recapitulatif_path
|
||||
end
|
||||
|
||||
def submit
|
||||
create_dossier_facade
|
||||
|
||||
@facade.dossier.submit!
|
||||
flash.notice = 'Dossier déposé avec succès.'
|
||||
|
||||
redirect_to users_dossier_recapitulatif_path
|
||||
end
|
||||
|
||||
def self.route_authorization
|
||||
{
|
||||
states: [:initiated, :replied, :updated, :validated, :received, :submitted, :without_continuation, :closed, :refused]
|
||||
states: [:initiated, :replied, :updated, :received, :without_continuation, :closed, :refused]
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@ class Dossier < ActiveRecord::Base
|
|||
initiated: 'initiated',
|
||||
replied: 'replied', #action utilisateur demandé
|
||||
updated: 'updated', #etude par l'administration en cours
|
||||
# validated: 'validated',
|
||||
# submitted: 'submitted',
|
||||
received: 'received',
|
||||
closed: 'closed',
|
||||
refused: 'refused',
|
||||
|
@ -42,7 +40,6 @@ class Dossier < ActiveRecord::Base
|
|||
|
||||
after_save :build_default_champs, if: Proc.new { procedure_id_changed? }
|
||||
after_save :build_default_individual, if: Proc.new { procedure.for_individual? }
|
||||
after_save :internal_notification
|
||||
|
||||
validates :user, presence: true
|
||||
|
||||
|
@ -50,14 +47,12 @@ class Dossier < ActiveRecord::Base
|
|||
NOUVEAUX = %w(initiated)
|
||||
OUVERT = %w(updated replied)
|
||||
WAITING_FOR_GESTIONNAIRE = %w(updated)
|
||||
WAITING_FOR_USER = %w(replied validated)
|
||||
WAITING_FOR_USER = %w(replied)
|
||||
EN_CONSTRUCTION = %w(initiated updated replied)
|
||||
VALIDES = %w(validated)
|
||||
DEPOSES = %w(submitted)
|
||||
EN_INSTRUCTION = %w(submitted received)
|
||||
EN_INSTRUCTION = %w(received)
|
||||
A_INSTRUIRE = %w(received)
|
||||
TERMINE = %w(closed refused without_continuation)
|
||||
ALL_STATE = %w(initiated updated replied validated submitted received closed refused without_continuation)
|
||||
ALL_STATE = %w(initiated updated replied received closed refused without_continuation)
|
||||
|
||||
def unreaded_notifications
|
||||
@unreaded_notif ||= notifications.where(already_read: false)
|
||||
|
@ -108,7 +103,7 @@ class Dossier < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def next_step! role, action
|
||||
unless %w(initiate follow update comment valid submit receive refuse without_continuation close).include?(action)
|
||||
unless %w(initiate follow update comment receive refuse without_continuation close).include?(action)
|
||||
fail 'action is not valid'
|
||||
end
|
||||
|
||||
|
@ -192,18 +187,6 @@ class Dossier < ActiveRecord::Base
|
|||
where(state: OUVERT, archived: false).order("updated_at #{order}")
|
||||
end
|
||||
|
||||
def self.valides order = 'ASC'
|
||||
where(state: VALIDES, archived: false).order("updated_at #{order}")
|
||||
end
|
||||
|
||||
def self.fige order = 'ASC'
|
||||
where(state: VALIDES, archived: false).order("updated_at #{order}")
|
||||
end
|
||||
|
||||
def self.deposes order = 'ASC'
|
||||
where(state: DEPOSES, archived: false).order("updated_at #{order}")
|
||||
end
|
||||
|
||||
def self.a_instruire order = 'ASC'
|
||||
where(state: A_INSTRUIRE, archived: false).order("updated_at #{order}")
|
||||
end
|
||||
|
@ -308,13 +291,6 @@ class Dossier < ActiveRecord::Base
|
|||
follows.size
|
||||
end
|
||||
|
||||
def submit!
|
||||
self.deposit_datetime= DateTime.now
|
||||
|
||||
next_step! 'user', 'submit'
|
||||
NotificationMailer.dossier_submitted(self).deliver_now!
|
||||
end
|
||||
|
||||
def read_only?
|
||||
received? || closed? || refused? || without_continuation?
|
||||
end
|
||||
|
@ -326,12 +302,4 @@ class Dossier < ActiveRecord::Base
|
|||
def invite_by_user? email
|
||||
(invites_user.pluck :email).include? email
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def internal_notification
|
||||
if state_changed? && state == 'submitted'
|
||||
NotificationService.new('submitted', self.id).notify
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,10 +8,7 @@ class DossiersListGestionnaireService
|
|||
def dossiers_to_display
|
||||
@dossiers_to_display ||=
|
||||
{'nouveaux' => nouveaux,
|
||||
# 'suivi' => suivi,
|
||||
'a_traiter' => ouvert,
|
||||
'fige' => fige,
|
||||
'deposes' => deposes,
|
||||
'a_instruire' => a_instruire,
|
||||
'termine' => termine,
|
||||
'all_state' => all_state}[@liste]
|
||||
|
@ -19,7 +16,7 @@ class DossiersListGestionnaireService
|
|||
end
|
||||
|
||||
def self.dossiers_liste_libelle
|
||||
['nouveaux', 'suivi', 'a_traiter', 'fige', 'deposes', 'a_instruire', 'termine', 'all_state']
|
||||
['nouveaux', 'suivi', 'a_traiter', 'a_instruire', 'termine', 'all_state']
|
||||
end
|
||||
|
||||
def all_state
|
||||
|
@ -38,14 +35,6 @@ class DossiersListGestionnaireService
|
|||
@ouvert ||= filter_dossiers.ouvert
|
||||
end
|
||||
|
||||
def fige
|
||||
@fige ||= filter_dossiers.fige
|
||||
end
|
||||
|
||||
def deposes
|
||||
@deposes ||= filter_dossiers.deposes
|
||||
end
|
||||
|
||||
def a_instruire
|
||||
@a_instruire ||= filter_dossiers.a_instruire
|
||||
end
|
||||
|
|
|
@ -7,7 +7,6 @@ class DossiersListUserService
|
|||
def dossiers_to_display
|
||||
{'brouillon' => brouillon,
|
||||
'a_traiter' => en_construction,
|
||||
'valides' => valides,
|
||||
'en_instruction' => en_instruction,
|
||||
'termine' => termine,
|
||||
'invite' => invite,
|
||||
|
@ -15,7 +14,7 @@ class DossiersListUserService
|
|||
end
|
||||
|
||||
def self.dossiers_liste_libelle
|
||||
['brouillon', 'a_traiter', 'valides', 'en_instruction', 'termine', 'invite', 'all_state']
|
||||
['brouillon', 'a_traiter', 'en_instruction', 'termine', 'invite', 'all_state']
|
||||
end
|
||||
|
||||
def all_state
|
||||
|
@ -34,10 +33,6 @@ class DossiersListUserService
|
|||
@invite ||= @current_devise_profil.invites
|
||||
end
|
||||
|
||||
def valides
|
||||
@valides ||= @current_devise_profil.dossiers.valides
|
||||
end
|
||||
|
||||
def en_instruction
|
||||
@en_instruction ||= @current_devise_profil.dossiers.en_instruction
|
||||
end
|
||||
|
|
|
@ -23,12 +23,6 @@
|
|||
.badge.progress-bar-danger
|
||||
= @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.'}
|
||||
-# %div.procedure_list_element{ class: @dossiers_list_facade.valides_class, id: 'valides' }
|
||||
-# ="À déposer"
|
||||
-# .badge.progress-bar-purple
|
||||
-# = @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.'}
|
||||
%div.procedure_list_element{ class: @dossiers_list_facade.en_instruction_class, id: 'en_instruction' }
|
||||
="En examen"
|
||||
|
|
|
@ -4,11 +4,6 @@
|
|||
%div.infos
|
||||
%div= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s
|
||||
|
||||
%div#action-block
|
||||
- if @facade.dossier.validated? && @facade.dossier.user == current_user
|
||||
= form_tag(url_for({controller: 'users/recapitulatif', action: :submit, dossier_id: @facade.dossier.id}), method: 'POST') do
|
||||
%button#validate_button.action= 'Procéder au dépôt définitif'
|
||||
|
||||
%div#menu-block
|
||||
|
||||
%div#infos-block
|
||||
|
|
|
@ -12,8 +12,6 @@ fr:
|
|||
initiated: "Nouveau"
|
||||
replied: "En construction"
|
||||
updated: "En construction"
|
||||
validated: "Figé"
|
||||
submitted: "Déposé / À réceptionner"
|
||||
received: "En instruction"
|
||||
closed: "Accepté"
|
||||
refused: "Refusé"
|
||||
|
|
|
@ -71,7 +71,6 @@ Rails.application.routes.draw do
|
|||
|
||||
get '/recapitulatif' => 'recapitulatif#show'
|
||||
post '/recapitulatif/initiate' => 'recapitulatif#initiate'
|
||||
post '/recapitulatif/submit' => 'recapitulatif#submit'
|
||||
|
||||
post '/commentaire' => 'commentaires#create'
|
||||
resources :commentaires, only: [:index]
|
||||
|
@ -159,7 +158,6 @@ Rails.application.routes.draw do
|
|||
resource :private_formulaire
|
||||
|
||||
resources :dossiers do
|
||||
post 'valid' => 'dossiers#valid'
|
||||
post 'receive' => 'dossiers#receive'
|
||||
post 'refuse' => 'dossiers#refuse'
|
||||
post 'without_continuation' => 'dossiers#without_continuation'
|
||||
|
@ -170,7 +168,6 @@ Rails.application.routes.draw do
|
|||
resources :commentaires, only: [:index]
|
||||
end
|
||||
|
||||
|
||||
namespace :dossiers do
|
||||
post 'filter'
|
||||
|
||||
|
|
|
@ -213,34 +213,9 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'POST #valid' do
|
||||
before do
|
||||
dossier.initiated!
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
subject { post :valid, params: {dossier_id: dossier_id} }
|
||||
|
||||
it 'change state to validated' do
|
||||
subject
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('validated')
|
||||
end
|
||||
|
||||
it 'Notification email is send' do
|
||||
expect(NotificationMailer).to receive(:dossier_validated).and_return(NotificationMailer)
|
||||
expect(NotificationMailer).to receive(:deliver_now!)
|
||||
|
||||
subject
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to backoffice_dossier_path(id: dossier.id) }
|
||||
end
|
||||
|
||||
describe 'POST #receive' do
|
||||
before do
|
||||
dossier.submitted!
|
||||
dossier.initiated!
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ shared_examples 'carte_controller_spec' do
|
|||
context 'when dossier’s procedure have api carto actived' do
|
||||
context 'when dossier does not have a valid state' do
|
||||
before do
|
||||
dossier.state = 'validated'
|
||||
dossier.state = 'received'
|
||||
dossier.save
|
||||
|
||||
get :show, params: {dossier_id: dossier.id}
|
||||
|
|
|
@ -37,7 +37,7 @@ shared_examples 'description_controller_spec' do
|
|||
describe 'before_action authorized_routes?' do
|
||||
context 'when dossier does not have a valid state' do
|
||||
before do
|
||||
dossier.state = 'validated'
|
||||
dossier.state = 'received'
|
||||
dossier.save
|
||||
|
||||
get :show, params: {dossier_id: dossier.id}
|
||||
|
|
|
@ -39,7 +39,7 @@ describe Users::DossiersController, type: :controller do
|
|||
describe 'before_action authorized_routes?' do
|
||||
context 'when dossier does not have a valid state' do
|
||||
before do
|
||||
dossier.state = 'validated'
|
||||
dossier.state = 'received'
|
||||
dossier.save
|
||||
|
||||
get :show, params: {id: dossier.id}
|
||||
|
@ -485,19 +485,6 @@ describe Users::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'GET #valides' do
|
||||
context 'when user is connected' do
|
||||
before do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :index, params: {liste: :valides}
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #en_instruction' do
|
||||
context 'when user is connected' do
|
||||
before do
|
||||
|
|
|
@ -52,40 +52,4 @@ describe Users::RecapitulatifController, type: :controller do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #submit' do
|
||||
context 'when an user depose his dossier' do
|
||||
let(:deposit_datetime) { Time.local(2016, 8, 1, 10, 5, 0) }
|
||||
|
||||
before do
|
||||
dossier.validated!
|
||||
Timecop.freeze(deposit_datetime) { post :submit, params: {dossier_id: dossier.id} }
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
it 'dossier change his state for submitted' do
|
||||
expect(dossier.state).to eq('submitted')
|
||||
end
|
||||
|
||||
it 'dossier deposit datetime is filled' do
|
||||
expect(dossier.deposit_datetime).to eq deposit_datetime
|
||||
end
|
||||
|
||||
it 'a message informe user what his dossier is initiated' do
|
||||
expect(flash[:notice]).to include('Dossier déposé avec succès.')
|
||||
end
|
||||
|
||||
it 'Notification email is send' do
|
||||
expect(NotificationMailer).to receive(:dossier_submitted).and_return(NotificationMailer)
|
||||
expect(NotificationMailer).to receive(:deliver_now!)
|
||||
|
||||
dossier.validated!
|
||||
post :submit, params: {dossier_id: dossier.id}
|
||||
end
|
||||
|
||||
it 'Internal notification is created' do
|
||||
expect(Notification.where(dossier_id: dossier.id, type_notif: 'submitted').first).not_to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,16 +37,6 @@ describe DossierDecorator do
|
|||
expect(subject).to eq('En construction')
|
||||
end
|
||||
|
||||
it 'validated is valide' do
|
||||
dossier.validated!
|
||||
expect(subject).to eq('Figé')
|
||||
end
|
||||
|
||||
it 'submitted is dépose' do
|
||||
dossier.submitted!
|
||||
expect(subject).to eq('Déposé / À réceptionner')
|
||||
end
|
||||
|
||||
it 'closed is traité' do
|
||||
dossier.closed!
|
||||
expect(subject).to eq('Accepté')
|
||||
|
|
|
@ -5,10 +5,7 @@ describe AdminProceduresShowFacades do
|
|||
|
||||
let!(:dossier_0) { create(:dossier, procedure: procedure, state: 'draft') }
|
||||
let!(:dossier_1) { create(:dossier, procedure: procedure, state: 'initiated') }
|
||||
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'validated') }
|
||||
let!(:dossier_3) { create(:dossier, procedure: procedure, state: 'validated') }
|
||||
let!(:dossier_4) { create(:dossier, procedure: procedure, archived: true, state: 'validated') }
|
||||
let!(:dossier_5) { create(:dossier, procedure: procedure, archived: true, state: 'validated') }
|
||||
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'replied') }
|
||||
let!(:dossier_6) { create(:dossier, procedure: procedure, archived: true, state: 'initiated') }
|
||||
let!(:dossier_7) { create(:dossier, procedure: procedure, state: 'updated') }
|
||||
|
||||
|
@ -23,37 +20,34 @@ describe AdminProceduresShowFacades do
|
|||
describe '.dossiers' do
|
||||
subject { super().dossiers }
|
||||
|
||||
it { expect(subject.size).to eq(7) }
|
||||
it { expect(subject.size).to eq(4) }
|
||||
end
|
||||
|
||||
describe '.dossiers_for_pie_highchart' do
|
||||
subject { super().dossiers_for_pie_highchart }
|
||||
|
||||
it { expect(subject).to eq({'Nouveau' => 1, 'Figé' => 2, "En construction"=>1}) }
|
||||
it { expect(subject).to eq({'Nouveau' => 1, "En construction"=>1}) }
|
||||
end
|
||||
|
||||
describe '.dossiers_archived_by_state_total' do
|
||||
subject { super().dossiers_archived_by_state_total }
|
||||
|
||||
it { expect(subject.size).to eq(2) }
|
||||
it { expect(subject.size).to eq(1) }
|
||||
|
||||
it { expect(subject.first.state).to eq('initiated') }
|
||||
it { expect(subject.first.total).to eq(1) }
|
||||
|
||||
it { expect(subject.last.state).to eq('validated') }
|
||||
it { expect(subject.last.total).to eq(2) }
|
||||
end
|
||||
|
||||
describe 'dossiers_archived_total' do
|
||||
subject { super().dossiers_archived_total }
|
||||
|
||||
it { is_expected.to eq(3) }
|
||||
it { is_expected.to eq(1) }
|
||||
end
|
||||
|
||||
describe 'dossiers_total' do
|
||||
subject { super().dossiers_total }
|
||||
|
||||
it { is_expected.to eq(7) }
|
||||
it { is_expected.to eq(4) }
|
||||
end
|
||||
|
||||
describe 'dossiers_waiting_gestionnaire_total' do
|
||||
|
@ -65,7 +59,7 @@ describe AdminProceduresShowFacades do
|
|||
describe 'dossiers_waiting_user_total' do
|
||||
subject { super().dossiers_waiting_user_total }
|
||||
|
||||
it { is_expected.to eq(2) }
|
||||
it { is_expected.to eq(1) }
|
||||
end
|
||||
|
||||
describe 'dossiers_termine_total' do
|
||||
|
|
|
@ -224,12 +224,6 @@ describe Dossier do
|
|||
|
||||
it { is_expected.to eq 'updated' }
|
||||
end
|
||||
|
||||
context 'when is validated the dossier' do
|
||||
let(:action) { 'valid' }
|
||||
|
||||
it { is_expected.to eq('validated') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -269,11 +263,6 @@ describe Dossier do
|
|||
it { is_expected.to eq 'replied' }
|
||||
end
|
||||
|
||||
context 'when is validated the dossier' do
|
||||
let(:action) { 'valid' }
|
||||
|
||||
it { is_expected.to eq('validated') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -307,74 +296,6 @@ describe Dossier do
|
|||
it { is_expected.to eq('replied') }
|
||||
end
|
||||
|
||||
context 'when is validated the dossier' do
|
||||
let(:action) { 'valid' }
|
||||
|
||||
it { is_expected.to eq('validated') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state validated' do
|
||||
before do
|
||||
dossier.validated!
|
||||
end
|
||||
|
||||
context 'when user is connect' do
|
||||
let(:role) { 'user' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
it { is_expected.to eq('validated') }
|
||||
end
|
||||
|
||||
context 'when is submitted the dossier' do
|
||||
let(:action) { 'submit' }
|
||||
|
||||
it { is_expected.to eq('submitted') }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when gestionnaire is connect' do
|
||||
let(:role) { 'gestionnaire' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('validated') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state submitted' do
|
||||
before do
|
||||
dossier.submitted!
|
||||
end
|
||||
|
||||
context 'when user is connected' do
|
||||
let(:role) { 'user' }
|
||||
|
||||
context 'when he posts a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('submitted') }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when gestionnaire is connect' do
|
||||
let(:role) { 'gestionnaire' }
|
||||
|
||||
context 'when he posts a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('submitted') }
|
||||
end
|
||||
|
||||
context 'when he receive the dossier' do
|
||||
let(:action) { 'receive' }
|
||||
|
||||
it { is_expected.to eq('received') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -505,14 +426,11 @@ describe Dossier do
|
|||
create(:dossier, procedure: procedure_admin, state: 'initiated') #nouveaux
|
||||
create(:dossier, procedure: procedure_admin, state: 'replied') #en_attente
|
||||
create(:dossier, procedure: procedure_admin, state: 'updated') #a_traiter
|
||||
create(:dossier, procedure: procedure_admin, state: 'submitted') #deposes
|
||||
create(:dossier, procedure: procedure_admin, state: 'received') #a_instruire
|
||||
create(:dossier, procedure: procedure_admin, state: 'received') #a_instruire
|
||||
create(:dossier, procedure: procedure_admin, state: 'closed') #termine
|
||||
create(:dossier, procedure: procedure_admin, state: 'refused') #termine
|
||||
create(:dossier, procedure: procedure_admin, state: 'without_continuation') #termine
|
||||
create(:dossier, procedure: procedure_admin_2, state: 'validated') #en_attente
|
||||
create(:dossier, procedure: procedure_admin_2, state: 'submitted') #deposes
|
||||
create(:dossier, procedure: procedure_admin_2, state: 'closed') #termine
|
||||
create(:dossier, procedure: procedure_admin, state: 'initiated', archived: true) #a_traiter #archived
|
||||
create(:dossier, procedure: procedure_admin, state: 'replied', archived: true) #en_attente #archived
|
||||
|
@ -543,12 +461,6 @@ describe Dossier do
|
|||
it { expect(subject.size).to eq(2) }
|
||||
end
|
||||
|
||||
describe '#deposes' do
|
||||
subject { gestionnaire.dossiers.deposes }
|
||||
|
||||
it { expect(subject.size).to eq(1) }
|
||||
end
|
||||
|
||||
describe '#termine' do
|
||||
subject { gestionnaire.dossiers.termine }
|
||||
|
||||
|
|
|
@ -33,16 +33,6 @@ describe UserRoutesAuthorizationService do
|
|||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'validated' do
|
||||
let(:state) { 'validated' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'submitted' do
|
||||
let(:state) { 'submitted' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
it { is_expected.to be_falsey }
|
||||
|
@ -74,16 +64,6 @@ describe UserRoutesAuthorizationService do
|
|||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'validated' do
|
||||
let(:state) { 'validated' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'submitted' do
|
||||
let(:state) { 'submitted' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
it { is_expected.to be_falsey }
|
||||
|
@ -113,16 +93,6 @@ describe UserRoutesAuthorizationService do
|
|||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
describe 'validated' do
|
||||
let(:state) { 'validated' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'submitted' do
|
||||
let(:state) { 'submitted' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
it { is_expected.to be_falsey }
|
||||
|
@ -153,16 +123,6 @@ describe UserRoutesAuthorizationService do
|
|||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
describe 'validated' do
|
||||
let(:state) { 'validated' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'submitted' do
|
||||
let(:state) { 'submitted' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
it { is_expected.to be_falsey }
|
||||
|
@ -192,16 +152,6 @@ describe UserRoutesAuthorizationService do
|
|||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
describe 'validated' do
|
||||
let(:state) { 'validated' }
|
||||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
describe 'submitted' do
|
||||
let(:state) { 'submitted' }
|
||||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
it { is_expected.to be_truthy }
|
||||
|
|
|
@ -9,8 +9,6 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|||
let!(:decorate_dossier_initiated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated').decorate }
|
||||
let!(:decorate_dossier_replied) { create(:dossier, :with_entreprise, procedure: procedure, state: 'replied').decorate }
|
||||
let!(:decorate_dossier_updated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated').decorate }
|
||||
let!(:decorate_dossier_validated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'validated').decorate }
|
||||
let!(:decorate_dossier_submitted) { create(:dossier, :with_entreprise, procedure: procedure, state: 'submitted').decorate }
|
||||
let!(:decorate_dossier_received) { create(:dossier, :with_entreprise, procedure: procedure, state: 'received').decorate }
|
||||
let!(:decorate_dossier_closed) { create(:dossier, :with_entreprise, procedure: procedure, state: 'closed').decorate }
|
||||
let!(:decorate_dossier_refused) { create(:dossier, :with_entreprise, procedure: procedure, state: 'refused').decorate }
|
||||
|
@ -25,8 +23,6 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|||
before do
|
||||
decorate_dossier_replied.entreprise.update_column(:raison_sociale, 'plap')
|
||||
decorate_dossier_updated.entreprise.update_column(:raison_sociale, 'plep')
|
||||
decorate_dossier_validated.entreprise.update_column(:raison_sociale, 'plip')
|
||||
decorate_dossier_submitted.entreprise.update_column(:raison_sociale, 'plop')
|
||||
decorate_dossier_received.entreprise.update_column(:raison_sociale, 'plup')
|
||||
decorate_dossier_closed.entreprise.update_column(:raison_sociale, 'plyp')
|
||||
decorate_dossier_refused.entreprise.update_column(:raison_sociale, 'plzp')
|
||||
|
@ -83,7 +79,7 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|||
|
||||
it { is_expected.to have_content('Nouveaux dossiers 1 dossiers') }
|
||||
it { is_expected.to have_content('Dossiers suivis 0 dossiers') }
|
||||
it { is_expected.to have_content('Tous les dossiers 9 dossiers') }
|
||||
it { is_expected.to have_content('Tous les dossiers 7 dossiers') }
|
||||
|
||||
it { is_expected.to have_content('État') }
|
||||
it { is_expected.to have_content('Libellé procédure') }
|
||||
|
@ -92,8 +88,6 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|||
|
||||
it { is_expected.to have_content('plap') }
|
||||
it { is_expected.to have_content('plep') }
|
||||
it { is_expected.to have_content('plip') }
|
||||
it { is_expected.to have_content('plop') }
|
||||
it { is_expected.to have_content('plup') }
|
||||
it { is_expected.to have_content('plyp') }
|
||||
end
|
|
@ -40,43 +40,6 @@ describe 'layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.htm
|
|||
it { expect(rendered).to have_content('En construction') }
|
||||
end
|
||||
|
||||
context 'when dossier state is validated' do
|
||||
let(:state) { 'validated' }
|
||||
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
it 'button Procéder au dépôt définitif est present' do
|
||||
expect(rendered).to have_css('#validate_button')
|
||||
expect(rendered).to have_content('Procéder au dépôt définitif')
|
||||
end
|
||||
|
||||
it 'button Editer mon dossier n\'est plus present' do
|
||||
expect(rendered).not_to have_css('#maj_infos')
|
||||
expect(rendered).not_to have_content('Modifier mon dossier')
|
||||
end
|
||||
|
||||
it 'button Modifier les document n\'est plus present' do
|
||||
expect(rendered).not_to have_content('Modifier les documents')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier state is submitted' do
|
||||
let(:state) { 'submitted' }
|
||||
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
it { expect(rendered).to have_content('Déposé / À réceptionner') }
|
||||
|
||||
it 'button Editer mon dossier n\'est plus present' do
|
||||
expect(rendered).not_to have_css('#maj_infos')
|
||||
expect(rendered).not_to have_content('Modifier mon dossier')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier state is closed' do
|
||||
let(:state) { 'closed' }
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
let!(:decorate_dossier_initiated) { create(:dossier, :with_entreprise, user: user, state: 'initiated').decorate }
|
||||
let!(:decorate_dossier_replied) { create(:dossier, :with_entreprise, user: user, state: 'replied').decorate }
|
||||
let!(:decorate_dossier_updated) { create(:dossier, :with_entreprise, user: user, state: 'updated').decorate }
|
||||
let!(:decorate_dossier_validated) { create(:dossier, :with_entreprise, user: user, state: 'validated').decorate }
|
||||
let!(:decorate_dossier_submitted) { create(:dossier, :with_entreprise, user: user, state: 'submitted').decorate }
|
||||
let!(:decorate_dossier_received) { create(:dossier, :with_entreprise, user: user, state: 'received').decorate }
|
||||
let!(:decorate_dossier_closed) { create(:dossier, :with_entreprise, user: user, state: 'closed').decorate }
|
||||
let!(:decorate_dossier_refused) { create(:dossier, :with_entreprise, user: user, state: 'refused').decorate }
|
||||
|
@ -61,27 +59,13 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'on tab etude a deposer' do
|
||||
let(:total_dossiers) { 1 }
|
||||
let(:active_class) { '.active .text-purple' }
|
||||
let(:dossiers_to_display) { user.dossiers.valides }
|
||||
let(:liste) { 'valides' }
|
||||
|
||||
it_behaves_like 'check_tab_content' do
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_validated }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'on tab etude en examen' do
|
||||
let(:total_dossiers) { 2 }
|
||||
let(:total_dossiers) { 1 }
|
||||
let(:active_class) { '.active .text-default' }
|
||||
let(:dossiers_to_display) { user.dossiers.en_instruction }
|
||||
let(:liste) { 'en_instruction' }
|
||||
|
||||
it_behaves_like 'check_tab_content' do
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_submitted }
|
||||
end
|
||||
|
||||
it_behaves_like 'check_tab_content' do
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_received }
|
||||
end
|
||||
|
|
|
@ -107,18 +107,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
|
|||
expect(rendered).not_to have_content('Archiver')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is validated' do
|
||||
let(:state) { 'validated' }
|
||||
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
it 'submitted link is not present' do
|
||||
expect(rendered).not_to have_content('Procéder au dépôt définitif')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'invite is by User' do
|
||||
|
@ -148,18 +136,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
|
|||
expect(rendered).not_to have_content('Archiver')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is validated' do
|
||||
let(:state) { 'validated' }
|
||||
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
it 'submitted link is not present' do
|
||||
expect(rendered).not_to have_content('Procéder au dépôt définitif')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue