Merge pull request #754 from sgmap/remove_replied_update_state

Remove replied update state
This commit is contained in:
LeSim 2017-09-26 14:54:15 +02:00 committed by GitHub
commit 87293b29ad
42 changed files with 58 additions and 338 deletions

View file

@ -179,7 +179,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
def reopen
create_dossier_facade params[:dossier_id]
@facade.dossier.replied!
@facade.dossier.initiated!
flash.notice = 'Dossier repassé en construction.'
redirect_to_dossier(@facade.dossier)

View file

@ -56,7 +56,7 @@ class Users::CarteController < UsersController
def self.route_authorization
{
states: [:draft, :initiated, :replied, :updated],
states: [:draft, :initiated],
api_carto: true
}
end

View file

@ -93,7 +93,7 @@ class Users::DescriptionController < UsersController
def self.route_authorization
{
states: [:draft, :initiated, :replied, :updated]
states: [:draft, :initiated]
}
end

View file

@ -18,7 +18,7 @@ class Users::RecapitulatifController < UsersController
def self.route_authorization
{
states: [:initiated, :replied, :updated, :received, :without_continuation, :closed, :refused]
states: [:initiated, :received, :without_continuation, :closed, :refused]
}
end

View file

@ -32,14 +32,6 @@ class AdminProceduresShowFacades
dossiers.size
end
def dossiers_waiting_gestionnaire_total
dossiers.waiting_for_gestionnaire.size
end
def dossiers_waiting_user_total
dossiers.waiting_for_user.size
end
def dossiers_termine_total
dossiers.where(state: :termine).size
end

View file

@ -2,8 +2,6 @@ class Dossier < ActiveRecord::Base
enum state: {
draft: 'draft',
initiated: 'initiated',
replied: 'replied', # action utilisateur demandé
updated: 'updated', # etude par l'administration en cours
received: 'received',
closed: 'closed',
refused: 'refused',
@ -12,13 +10,9 @@ class Dossier < ActiveRecord::Base
BROUILLON = %w(draft)
NOUVEAUX = %w(initiated)
OUVERT = %w(updated replied)
WAITING_FOR_GESTIONNAIRE = %w(updated)
WAITING_FOR_USER = %w(replied)
EN_CONSTRUCTION = %w(initiated updated replied)
EN_CONSTRUCTION = %w(initiated)
EN_INSTRUCTION = %w(received)
EN_CONSTRUCTION_OU_INSTRUCTION = EN_CONSTRUCTION + EN_INSTRUCTION
A_INSTRUIRE = %w(received)
TERMINE = %w(closed refused without_continuation)
has_one :etablissement, dependent: :destroy
@ -50,13 +44,9 @@ class Dossier < ActiveRecord::Base
scope :state_brouillon, -> { where(state: BROUILLON) }
scope :state_not_brouillon, -> { where.not(state: BROUILLON) }
scope :state_nouveaux, -> { where(state: NOUVEAUX) }
scope :state_ouvert, -> { where(state: OUVERT) }
scope :state_waiting_for_gestionnaire, -> { where(state: WAITING_FOR_GESTIONNAIRE) }
scope :state_waiting_for_user, -> { where(state: WAITING_FOR_USER) }
scope :state_en_construction, -> { where(state: EN_CONSTRUCTION) }
scope :state_en_instruction, -> { where(state: EN_INSTRUCTION) }
scope :state_en_construction_ou_instruction, -> { where(state: EN_CONSTRUCTION_OU_INSTRUCTION) }
scope :state_a_instruire, -> { where(state: A_INSTRUIRE) }
scope :state_termine, -> { where(state: TERMINE) }
scope :archived, -> { where(archived: true) }
@ -66,10 +56,7 @@ class Dossier < ActiveRecord::Base
scope :all_state, -> { not_archived.state_not_brouillon.order_by_updated_at(:asc) }
scope :nouveaux, -> { not_archived.state_nouveaux.order_by_updated_at(:asc) }
scope :ouvert, -> { not_archived.state_ouvert.order_by_updated_at(:asc) }
scope :waiting_for_gestionnaire, -> { not_archived.state_waiting_for_gestionnaire.order_by_updated_at(:asc) }
scope :waiting_for_user, -> { not_archived.state_waiting_for_user.order_by_updated_at(:asc) }
scope :a_instruire, -> { not_archived.state_a_instruire.order_by_updated_at(:asc) }
scope :en_instruction, -> { not_archived.state_en_instruction.order_by_updated_at(:asc) }
scope :termine, -> { not_archived.state_termine.order_by_updated_at(:asc) }
scope :downloadable, -> { state_not_brouillon.order_by_updated_at(:asc) }
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction.order_by_updated_at(:asc) }
@ -170,27 +157,9 @@ class Dossier < ActiveRecord::Base
if draft?
initiated!
end
when 'update'
if replied?
updated!
end
when 'comment'
if replied?
updated!
end
end
when 'gestionnaire'
case action
when 'comment'
if updated?
replied!
elsif initiated?
replied!
end
when 'follow'
if initiated?
updated!
end
when 'close'
if received?
self.attestation = build_attestation

View file

@ -8,7 +8,7 @@ class DossiersListGestionnaireService
def dossiers_to_display
@dossiers_to_display ||=
{'nouveaux' => nouveaux,
'a_traiter' => ouvert,
'a_traiter' => nouveaux,
'a_instruire' => a_instruire,
'termine' => termine,
'archive' => archive,
@ -31,12 +31,8 @@ class DossiersListGestionnaireService
@nouveaux ||= filter_dossiers.nouveaux
end
def ouvert
@ouvert ||= filter_dossiers.ouvert
end
def a_instruire
@a_instruire ||= filter_dossiers.a_instruire
@a_instruire ||= filter_dossiers.en_instruction
end
def archive

View file

@ -98,14 +98,6 @@
%div
= @facade.dossiers_total
%h4.text-danger Attente Accompagnateur
%div
= @facade.dossiers_waiting_gestionnaire_total
%h4.text-info Attente Usager
%div
= @facade.dossiers_waiting_user_total
%h4.text-success Terminé
%div
= @facade.dossiers_termine_total

View file

@ -13,7 +13,7 @@
.col-xs-8.title-no-expanse
.carret-right
INFORMATIONS DU DEMANDEUR
- if !@current_gestionnaire && ["draft", "updated", "replied", "initiated"].include?(@facade.dossier.state)
- if !@current_gestionnaire && ["draft", "initiated"].include?(@facade.dossier.state)
%a#add_siret.action{ href: users_dossier_add_siret_path(dossier_id: @facade.dossier.id) }
.col-lg-4.col-md-4.col-sm-4.col-xs-4.action
Renseigner un SIRET

View file

@ -10,8 +10,6 @@ fr:
state:
draft: "Brouillon"
initiated: "En construction"
replied: "En construction"
updated: "En construction"
received: "En instruction"
closed: "Accepté"
refused: "Refusé"

View file

@ -45,7 +45,7 @@
"updated_at": "2008-09-01T08:05:00.000Z",
"archived": false,
"mandataire_social": false,
"state": "updated",
"state": "initiated",
"simplified_state": "En construction",
"initiated_at": "2017-04-11T12:00:12.000Z",
"received_at": null,

View file

@ -0,0 +1,5 @@
namespace :'2017_09_22_set_dossier_updated_replied_to_initiated' do
task set: :environment do
Dossier.unscoped.where(state: [:updated, :replied]).update_all(state: :initiated)
end
end

View file

@ -1,7 +1,7 @@
require 'spec_helper'
describe Backoffice::CommentairesController, type: :controller do
let(:dossier) { create(:dossier, :replied) }
let(:dossier) { create(:dossier, :initiated) }
let(:dossier_id) { dossier.id }
let(:email_commentaire) { 'test@test.com' }
let(:texte_commentaire) { 'Commentaire de test' }
@ -113,19 +113,15 @@ describe Backoffice::CommentairesController, type: :controller do
describe 'change dossier state after post a comment' do
context 'gestionnaire is connected' do
context 'when dossier is at state updated' do
context 'when dossier is at state initiated' do
before do
sign_in gestionnaire
dossier.updated!
dossier.initiated!
post :create, params: {dossier_id: dossier_id, texte_commentaire: texte_commentaire}
dossier.reload
end
subject { dossier.state }
it { is_expected.to eq('replied') }
it 'Notification email is send' do
expect(NotificationMailer).to receive(:new_answer).and_return(NotificationMailer)
expect(NotificationMailer).to receive(:deliver_now!)

View file

@ -360,11 +360,11 @@ describe Backoffice::DossiersController, type: :controller do
subject { post :reopen, params: {dossier_id: dossier_id} }
it 'change state to replied' do
it 'change state to initiated' do
subject
dossier.reload
expect(dossier.state).to eq('replied')
expect(dossier.state).to eq('initiated')
end
it { is_expected.to redirect_to backoffice_dossier_path(id: dossier_id) }

View file

@ -1,7 +1,7 @@
require 'spec_helper'
describe InvitesController, type: :controller do
let(:dossier) { create(:dossier, :replied) }
let(:dossier) { create(:dossier, :initiated) }
let(:email) { 'plop@octo.com' }
describe '#POST create' do

View file

@ -6,7 +6,7 @@ describe NewGestionnaire::AvisController, type: :controller do
let(:claimant) { create(:gestionnaire) }
let(:gestionnaire) { create(:gestionnaire) }
let(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
let(:dossier) { create(:dossier, :replied, procedure: procedure) }
let(:dossier) { create(:dossier, :initiated, procedure: procedure) }
let!(:avis_without_answer) { Avis.create(dossier: dossier, claimant: claimant, gestionnaire: gestionnaire) }
let!(:avis_with_answer) { Avis.create(dossier: dossier, claimant: claimant, gestionnaire: gestionnaire, answer: 'yop') }

View file

@ -5,16 +5,16 @@ describe NewGestionnaire::DossiersController, type: :controller do
let(:gestionnaire) { create(:gestionnaire) }
let(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
let(:dossier) { create(:dossier, :replied, procedure: procedure) }
let(:dossier) { create(:dossier, :initiated, procedure: procedure) }
before { sign_in(gestionnaire) }
describe '#attestation' do
context 'when a dossier has an attestation' do
let(:fake_pdf) { double(read: 'pdf content') }
let!(:dossier) { create(:dossier, :replied, attestation: Attestation.new, procedure: procedure) }
let!(:dossier) { create(:dossier, :initiated, attestation: Attestation.new, procedure: procedure) }
let!(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
let!(:dossier) { create(:dossier, :replied, attestation: Attestation.new, procedure: procedure) }
let!(:dossier) { create(:dossier, :initiated, attestation: Attestation.new, procedure: procedure) }
it 'returns the attestation pdf' do
allow_any_instance_of(Attestation).to receive(:pdf).and_return(fake_pdf)
@ -148,7 +148,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
end
let(:dossier) do
create(:dossier, :replied, procedure: procedure, champs_private: [champ_multiple_drop_down_list, champ_datetime])
create(:dossier, :initiated, procedure: procedure, champs_private: [champ_multiple_drop_down_list, champ_datetime])
end
before do

View file

@ -137,12 +137,12 @@ describe NewGestionnaire::ProceduresController, type: :controller do
let(:state) { "initiated" }
before do
create(:dossier, procedure: procedure, state: "replied")
create(:dossier, procedure: procedure, state: "initiated")
create(:dossier, procedure: procedure, state: "received")
create(:dossier, procedure: procedure, state: "without_continuation", archived: true)
gestionnaire.procedures << procedure2
create(:dossier, :followed, procedure: procedure2, state: "updated")
create(:dossier, :followed, procedure: procedure2, state: "initiated")
create(:dossier, procedure: procedure2, state: "closed")
gestionnaire.followed_dossiers << create(:dossier, procedure: procedure2, state: "received")

View file

@ -1,8 +1,8 @@
require 'spec_helper'
describe NewGestionnaire::RecherchesController, type: :controller do
let(:dossier) { create(:dossier, :replied) }
let(:dossier2) { create(:dossier, :replied, procedure: dossier.procedure) }
let(:dossier) { create(:dossier, :initiated) }
let(:dossier2) { create(:dossier, :initiated, procedure: dossier.procedure) }
let(:gestionnaire) { create(:gestionnaire) }
before { gestionnaire.procedures << dossier2.procedure }
@ -26,7 +26,7 @@ describe NewGestionnaire::RecherchesController, type: :controller do
end
context 'when gestionnaire do not own the dossier' do
let(:dossier3) { create(:dossier, :replied) }
let(:dossier3) { create(:dossier, :initiated) }
let(:query) { dossier3.id }
it { is_expected.to have_http_status(200) }

View file

@ -102,23 +102,5 @@ describe Users::CommentairesController, type: :controller do
end
end
end
describe 'change dossier state after post a comment' do
context 'when user is connected' do
context 'when dossier is at state replied' do
before do
sign_in dossier.user
dossier.replied!
post :create, params: { dossier_id: dossier_id, texte_commentaire: texte_commentaire }
dossier.reload
end
subject { dossier.state }
it { is_expected.to eq('updated') }
end
end
end
end
end

View file

@ -15,13 +15,11 @@ describe Users::Dossiers::CommentairesController, type: :controller do
before do
sign_in invite.user
dossier.replied!
end
it do
subject
is_expected.to redirect_to users_dossiers_invite_path(invite.id)
expect(dossier.state).to eq 'replied'
end
it 'should notify user' do

View file

@ -27,16 +27,6 @@ describe DossierDecorator do
expect(subject).to eq('En construction')
end
it 'replied is repondu' do
dossier.replied!
expect(subject).to eq('En construction')
end
it 'updated is mis à jour' do
dossier.updated!
expect(subject).to eq('En construction')
end
it 'closed is traité' do
dossier.closed!
expect(subject).to eq('Accepté')
@ -79,7 +69,7 @@ describe DossierDecorator do
context "when the dossier is not in brouillon state" do
before do
dossier.state = 'updated'
dossier.state = 'initiated'
dossier.save
end

View file

@ -5,9 +5,8 @@ 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: 'replied') }
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'initiated') }
let!(:dossier_6) { create(:dossier, procedure: procedure, archived: true, state: 'initiated') }
let!(:dossier_7) { create(:dossier, procedure: procedure, state: 'updated') }
subject { AdminProceduresShowFacades.new procedure }
@ -20,13 +19,13 @@ describe AdminProceduresShowFacades do
describe '.dossiers' do
subject { super().dossiers }
it { expect(subject.size).to eq(4) }
it { expect(subject.size).to eq(3) }
end
describe '.dossiers_for_pie_highchart' do
subject { super().dossiers_for_pie_highchart }
it { expect(subject).to eq({ 'En construction' => 3 }) }
it { expect(subject).to eq({ 'En construction' => 2 }) }
end
describe '.dossiers_archived_by_state_total' do
@ -47,19 +46,7 @@ describe AdminProceduresShowFacades do
describe 'dossiers_total' do
subject { super().dossiers_total }
it { is_expected.to eq(4) }
end
describe 'dossiers_waiting_gestionnaire_total' do
subject { super().dossiers_waiting_gestionnaire_total }
it { is_expected.to eq(1) }
end
describe 'dossiers_waiting_user_total' do
subject { super().dossiers_waiting_user_total }
it { is_expected.to eq(1) }
it { is_expected.to eq(3) }
end
describe 'dossiers_termine_total' do

View file

@ -72,8 +72,8 @@ FactoryGirl.define do
end
end
trait :replied do
state 'replied'
trait :initiated do
state 'initiated'
end
end
end

View file

@ -2,7 +2,7 @@ require 'spec_helper'
feature 'add commentaire on backoffice' do
let(:procedure) { create(:procedure, :published) }
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated') }
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
let(:dossier_id) { dossier.id }
let!(:commentaire) { create(:commentaire, dossier: dossier, email: 'toto@toto.com') }
let(:email_commentaire) { 'test@test.com' }

View file

@ -3,7 +3,7 @@ require 'spec_helper'
feature 'backoffice: flux de commentaires' do
let(:procedure) { create(:procedure, :published) }
let(:gestionnaire) { create(:gestionnaire) }
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated') }
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
let(:dossier_id) { dossier.id }
let(:champ1) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ_public, libelle: "subtitle1")) }

View file

@ -6,7 +6,7 @@ feature 'usage of pref list dossier lateral panel', js: true do
let(:procedure) { create(:procedure, :published, administrateur: administrateur) }
before do
create(:dossier, :with_entreprise, procedure: procedure, state: 'updated')
create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated')
create :assign_to, procedure: procedure, gestionnaire: gestionnaire
login_as gestionnaire, scope: :gestionnaire

View file

@ -6,7 +6,7 @@ feature 'usage of pref list dossier lateral panel by procedure', js: true do
let(:procedure) { create(:procedure, :published, :with_type_de_champ, administrateur: administrateur) }
before do
create(:dossier, :with_entreprise, procedure: procedure, state: 'updated')
create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated')
create :assign_to, procedure: procedure, gestionnaire: gestionnaire
login_as gestionnaire, scope: :gestionnaire

View file

@ -6,8 +6,8 @@ feature 'on backoffice page', js: true do
let(:procedure) { create(:procedure, :published, administrateur: administrateur) }
let(:procedure_individual) { create :procedure, :published, libelle: 'procedure individual', administrateur: administrateur, for_individual: true }
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated') }
let!(:dossier_individual) { create :dossier, procedure: procedure_individual, state: 'updated' }
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
let!(:dossier_individual) { create :dossier, procedure: procedure_individual, state: 'initiated' }
before do
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
@ -34,7 +34,7 @@ feature 'on backoffice page', js: true do
end
context "and goes to the page of a dossier he hasn't access to" do
let!(:unauthorized_dossier) { create(:dossier, :with_entreprise, state: 'updated') }
let!(:unauthorized_dossier) { create(:dossier, :with_entreprise, state: 'initiated') }
before do
visit backoffice_dossier_path(unauthorized_dossier)

View file

@ -2,7 +2,7 @@ require 'spec_helper'
feature 'users: flux de commentaires' do
let(:user) { create(:user) }
let(:dossier) { create(:dossier, :with_entreprise, user: user, state: "replied") }
let(:dossier) { create(:dossier, :with_entreprise, user: user, state: "initiated") }
let(:dossier_id) { dossier.id }
let(:champ1) { dossier.champs.first }

View file

@ -2,10 +2,10 @@ require 'spec_helper'
describe 'user access to the list of his dossier' do
let(:user) { create(:user) }
let!(:last_updated_dossier) { create(:dossier, :with_entreprise, user: user, state: 'replied')}
let!(:dossier1) { create(:dossier, :with_entreprise, user: user, state: 'replied') }
let!(:last_updated_dossier) { create(:dossier, :with_entreprise, user: user, state: 'initiated')}
let!(:dossier1) { create(:dossier, :with_entreprise, user: user, state: 'initiated') }
let!(:dossier2) { create(:dossier, :with_entreprise) }
let!(:dossier_archived) { create(:dossier, :with_entreprise, user: user, state: 'replied') }
let!(:dossier_archived) { create(:dossier, :with_entreprise, user: user, state: 'initiated') }
before do
last_updated_dossier.update_column(:updated_at, "19/07/2052 15:35".to_time)

View file

@ -7,8 +7,6 @@ feature 'on click on tabs button' do
before do
create(:dossier, :with_entreprise, user: user, state: 'initiated')
create(:dossier, :with_entreprise, user: user, state: 'replied')
create(:dossier, :with_entreprise, user: user, state: 'updated')
create(:dossier, :with_entreprise, user: user, state: 'received')
create(:dossier, :with_entreprise, user: user, state: 'closed')
create(:dossier, :with_entreprise, user: user, state: 'refused')
@ -23,7 +21,7 @@ feature 'on click on tabs button' do
context 'when he click on tabs en construction' do
before do
visit users_dossiers_url(liste: :a_traiter)
page.click_on 'En construction 3'
page.click_on 'En construction 1'
end
scenario 'it redirect to users dossier termine' do

View file

@ -182,83 +182,13 @@ describe Dossier do
context 'when is post a comment' do
let(:action) { 'comment' }
it { is_expected.to eq('replied') }
it { is_expected.to eq('initiated') }
end
context 'when is follow' do
let(:action) { 'follow' }
it { is_expected.to eq 'updated' }
end
end
end
context 'when dossier is at state replied' do
before do
dossier.replied!
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('updated') }
end
context 'when is updated dossier informations' do
let(:action) { 'update' }
it { is_expected.to eq('updated') }
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('replied') }
end
context 'when is follow' do
let(:action) { 'follow' }
it { is_expected.to eq 'replied' }
end
end
end
context 'when dossier is at state updated' do
before do
dossier.updated!
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('updated') }
end
context 'when is updated dossier informations' do
let(:action) { 'update' }
it { is_expected.to eq('updated') }
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('replied') }
it { is_expected.to eq 'initiated' }
end
end
end

View file

@ -309,7 +309,7 @@ describe Procedure do
before do
create :dossier, procedure: procedure, state: :initiated
create :dossier, procedure: procedure, state: :draft
create :dossier, procedure: procedure, state: :replied
create :dossier, procedure: procedure, state: :initiated
end
subject { procedure.total_dossier }

View file

@ -348,8 +348,6 @@ describe DossiersListGestionnaireService do
let!(:dossier) { create(:dossier, procedure: procedure, state: 'draft') }
let!(:dossier2) { create(:dossier, procedure: procedure, state: 'initiated') } #nouveaux
let!(:dossier3) { create(:dossier, procedure: procedure, state: 'initiated') } #nouveaux
let!(:dossier4) { create(:dossier, procedure: procedure, state: 'replied') } #en_attente
let!(:dossier5) { create(:dossier, procedure: procedure, state: 'updated') } #a_traiter
let!(:dossier6) { create(:dossier, procedure: procedure, state: 'received') } #a_instruire
let!(:dossier7) { create(:dossier, procedure: procedure, state: 'received') } #a_instruire
let!(:dossier8) { create(:dossier, procedure: procedure, state: 'closed') } #termine
@ -357,7 +355,6 @@ describe DossiersListGestionnaireService do
let!(:dossier10) { create(:dossier, procedure: procedure, state: 'without_continuation') } #termine
let!(:dossier11) { create(:dossier, procedure: procedure, state: 'closed') } #termine
let!(:dossier12) { create(:dossier, procedure: procedure, state: 'initiated', archived: true) } #a_traiter #archived
let!(:dossier13) { create(:dossier, procedure: procedure, state: 'replied', archived: true) } #en_attente #archived
let!(:dossier14) { create(:dossier, procedure: procedure, state: 'closed', archived: true) } #termine #archived
describe '#termine' do

View file

@ -23,16 +23,6 @@ describe UserRoutesAuthorizationService do
it { is_expected.to be_falsey }
end
describe 'replied' do
let(:state) { 'replied' }
it { is_expected.to be_falsey }
end
describe 'updated' do
let(:state) { 'updated' }
it { is_expected.to be_falsey }
end
describe 'closed' do
let(:state) { 'closed' }
it { is_expected.to be_falsey }
@ -53,16 +43,6 @@ describe UserRoutesAuthorizationService do
it { is_expected.to be_falsey }
end
describe 'replied' do
let(:state) { 'replied' }
it { is_expected.to be_falsey }
end
describe 'updated' do
let(:state) { 'updated' }
it { is_expected.to be_falsey }
end
describe 'closed' do
let(:state) { 'closed' }
it { is_expected.to be_falsey }
@ -82,16 +62,6 @@ describe UserRoutesAuthorizationService do
it { is_expected.to be_truthy }
end
describe 'replied' do
let(:state) { 'replied' }
it { is_expected.to be_truthy }
end
describe 'updated' do
let(:state) { 'updated' }
it { is_expected.to be_truthy }
end
describe 'closed' do
let(:state) { 'closed' }
it { is_expected.to be_falsey }
@ -112,16 +82,6 @@ describe UserRoutesAuthorizationService do
it { is_expected.to be_truthy }
end
describe 'replied' do
let(:state) { 'replied' }
it { is_expected.to be_truthy }
end
describe 'updated' do
let(:state) { 'updated' }
it { is_expected.to be_truthy }
end
describe 'closed' do
let(:state) { 'closed' }
it { is_expected.to be_falsey }
@ -141,16 +101,6 @@ describe UserRoutesAuthorizationService do
it { is_expected.to be_truthy }
end
describe 'replied' do
let(:state) { 'replied' }
it { is_expected.to be_truthy }
end
describe 'updated' do
let(:state) { 'updated' }
it { is_expected.to be_truthy }
end
describe 'closed' do
let(:state) { 'closed' }
it { is_expected.to be_truthy }

View file

@ -7,8 +7,6 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
let!(:procedure) { create(:procedure, :published, administrateur: administrateur) }
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_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 }
@ -21,8 +19,6 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
let(:all_state_dossiers_list) { dossiers_list_facade.service.all_state }
before do
decorate_dossier_replied.entreprise.update_column(:raison_sociale, 'plap')
decorate_dossier_updated.entreprise.update_column(:raison_sociale, 'plep')
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')
@ -79,15 +75,13 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
it { is_expected.to have_content('Nouveaux dossiers 1 dossier') }
it { is_expected.to have_content('Dossiers suivis 0 dossiers') }
it { is_expected.to have_content('Tous les dossiers 7 dossiers') }
it { is_expected.to have_content('Tous les dossiers 5 dossiers') }
it { is_expected.to have_content('État') }
it { is_expected.to have_content('Libellé procédure') }
it { is_expected.to have_content('Raison sociale') }
it { is_expected.to have_content('Mise à jour le') }
it { is_expected.to have_content('plap') }
it { is_expected.to have_content('plep') }
it { is_expected.to have_content('plup') }
it { is_expected.to have_content('plyp') }
end

View file

@ -40,30 +40,6 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
include_examples 'button Passer en instruction is present'
end
context 'when dossier have state replied' do
let(:state) { 'replied' }
before do
render
end
it { expect(rendered).to have_content('En construction') }
include_examples 'button Passer en instruction is present'
end
context 'when dossier have state update' do
let(:state) { 'updated' }
before do
render
end
it { expect(rendered).to have_content('En construction') }
include_examples 'button Passer en instruction is present'
end
context 'when dossier have state received' do
let(:state) { 'received' }

View file

@ -20,26 +20,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 replied' do
let(:state) { 'replied' }
before do
render
end
it { expect(rendered).to have_content('En construction') }
end
context 'when dossier state is updated' do
let(:state) { 'updated' }
before do
render
end
it { expect(rendered).to have_content('En construction') }
end
context 'when dossier state is closed' do
let(:state) { 'closed' }

View file

@ -1,7 +1,7 @@
describe 'new_gestionnaire/dossiers/show.html.haml', type: :view do
let(:individual) { nil }
let(:entreprise) { nil }
let(:dossier) { create(:dossier, :replied, entreprise: entreprise, individual: individual) }
let(:dossier) { create(:dossier, :initiated, entreprise: entreprise, individual: individual) }
before do
assign(:dossier, dossier)

View file

@ -4,8 +4,6 @@ describe 'users/dossiers/index.html.haml', type: :view do
let(:user) { create(:user) }
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_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 }
@ -41,7 +39,7 @@ describe 'users/dossiers/index.html.haml', type: :view do
end
describe 'on tab en construction' do
let(:total_dossiers) { 3 }
let(:total_dossiers) { 1 }
let(:active_class) { '.active .text-danger' }
let(:dossiers_to_display) { user.dossiers.state_en_construction }
let(:liste) { 'a_traiter' }
@ -49,14 +47,6 @@ describe 'users/dossiers/index.html.haml', type: :view do
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_initiated }
end
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_replied }
end
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_updated }
end
end
describe 'on tab etude en examen' do

View file

@ -20,8 +20,8 @@ RSpec.describe AutoArchiveProcedureWorker, type: :worker do
context "when procedures have auto_archive_on set on yesterday or today" do
let!(:dossier1) { create(:dossier, procedure: procedure_hier, state: 'draft', archived: false)}
let!(:dossier2) { create(:dossier, procedure: procedure_hier, state: 'initiated', archived: false)}
let!(:dossier3) { create(:dossier, procedure: procedure_hier, state: 'replied', archived: false)}
let!(:dossier4) { create(:dossier, procedure: procedure_hier, state: 'updated', archived: false)}
let!(:dossier3) { create(:dossier, procedure: procedure_hier, state: 'initiated', archived: false)}
let!(:dossier4) { create(:dossier, procedure: procedure_hier, state: 'initiated', archived: false)}
let!(:dossier5) { create(:dossier, procedure: procedure_hier, state: 'received', archived: false)}
let!(:dossier6) { create(:dossier, procedure: procedure_hier, state: 'closed', archived: false)}
let!(:dossier7) { create(:dossier, procedure: procedure_hier, state: 'refused', archived: false)}