commit
926b723d80
19 changed files with 110 additions and 64 deletions
|
@ -6,7 +6,7 @@ class Admin::ProceduresController < AdminController
|
|||
|
||||
def index
|
||||
@procedures = smart_listing_create :procedures,
|
||||
current_administrateur.procedures.published.not_archived.order(created_at: :desc),
|
||||
current_administrateur.procedures.publiees.order(created_at: :desc),
|
||||
partial: "admin/procedures/list",
|
||||
array: true
|
||||
|
||||
|
@ -15,7 +15,7 @@ class Admin::ProceduresController < AdminController
|
|||
|
||||
def archived
|
||||
@procedures = smart_listing_create :procedures,
|
||||
current_administrateur.procedures.archived.order(created_at: :desc),
|
||||
current_administrateur.procedures.archivees.order(created_at: :desc),
|
||||
partial: "admin/procedures/list",
|
||||
array: true
|
||||
|
||||
|
@ -26,7 +26,7 @@ class Admin::ProceduresController < AdminController
|
|||
|
||||
def draft
|
||||
@procedures = smart_listing_create :procedures,
|
||||
current_administrateur.procedures.not_published.not_archived.order(created_at: :desc),
|
||||
current_administrateur.procedures.brouillons.order(created_at: :desc),
|
||||
partial: "admin/procedures/list",
|
||||
array: true
|
||||
|
||||
|
@ -53,7 +53,7 @@ class Admin::ProceduresController < AdminController
|
|||
def destroy
|
||||
procedure = Procedure.find(params[:id])
|
||||
|
||||
return render json: {}, status: 401 if procedure.published? || procedure.archived?
|
||||
return render json: {}, status: 401 if procedure.publiee_ou_archivee?
|
||||
|
||||
procedure.destroy
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ class DemoController < ApplicationController
|
|||
return redirect_to root_path if Rails.env.production?
|
||||
|
||||
smart_listing_create :procedures,
|
||||
Procedure.published.not_archived.order("id DESC"),
|
||||
Procedure.publiees.order("id DESC"),
|
||||
partial: "demo/list",
|
||||
array: true
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ class StatsController < ApplicationController
|
|||
MEAN_NUMBER_OF_CHAMPS_IN_A_FORM = 24.0
|
||||
|
||||
def index
|
||||
procedures = Procedure.published
|
||||
procedures = Procedure.publiee_ou_archivee
|
||||
dossiers = Dossier.where.not(:state => :draft)
|
||||
|
||||
@procedures_count = procedures.count
|
||||
|
|
|
@ -47,7 +47,7 @@ class Users::DossiersController < UsersController
|
|||
end
|
||||
end
|
||||
|
||||
if procedure.archived?
|
||||
if procedure.archivee?
|
||||
|
||||
@dossier = Dossier.new(procedure: procedure)
|
||||
|
||||
|
@ -60,7 +60,7 @@ class Users::DossiersController < UsersController
|
|||
end
|
||||
|
||||
def new
|
||||
procedure = Procedure.not_archived.published.find(params[:procedure_id])
|
||||
procedure = Procedure.publiees.find(params[:procedure_id])
|
||||
|
||||
dossier = Dossier.create(procedure: procedure, user: current_user, state: 'draft')
|
||||
siret = params[:siret] || current_user.siret
|
||||
|
|
|
@ -285,7 +285,7 @@ class Dossier < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def can_be_initiated?
|
||||
!(procedure.archived? && draft?)
|
||||
!(procedure.archivee? && draft?)
|
||||
end
|
||||
|
||||
def text_summary
|
||||
|
|
|
@ -108,7 +108,7 @@ class Gestionnaire < ActiveRecord::Base
|
|||
start_date = DateTime.now.beginning_of_week
|
||||
|
||||
active_procedure_overviews = procedures
|
||||
.published
|
||||
.publiees
|
||||
.map { |procedure| procedure.procedure_overview(start_date) }
|
||||
.select(&:had_some_activities?)
|
||||
|
||||
|
|
|
@ -32,11 +32,11 @@ class Procedure < ActiveRecord::Base
|
|||
mount_uploader :logo, ProcedureLogoUploader
|
||||
|
||||
default_scope { where(hidden_at: nil) }
|
||||
scope :published, -> { where.not(published_at: nil) }
|
||||
scope :not_published, -> { where(published_at: nil) }
|
||||
scope :archived, -> { where.not(archived_at: nil) }
|
||||
scope :not_archived, -> { where(archived_at: nil) }
|
||||
scope :by_libelle, -> { order(libelle: :asc) }
|
||||
scope :brouillons, -> { where(published_at: nil).where(archived_at: nil) }
|
||||
scope :publiees, -> { where.not(published_at: nil).where(archived_at: nil) }
|
||||
scope :archivees, -> { where.not(archived_at: nil) }
|
||||
scope :publiee_ou_archivee, -> { where.not(published_at: nil) }
|
||||
scope :by_libelle, -> { order(libelle: :asc) }
|
||||
|
||||
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
||||
validates :description, presence: true, allow_blank: false, allow_nil: false
|
||||
|
@ -64,7 +64,7 @@ class Procedure < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.active id
|
||||
not_archived.published.find(id)
|
||||
publiees.find(id)
|
||||
end
|
||||
|
||||
def switch_types_de_champ index_of_first_element
|
||||
|
@ -94,7 +94,7 @@ class Procedure < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def locked?
|
||||
published?
|
||||
publiee_ou_archivee?
|
||||
end
|
||||
|
||||
def clone
|
||||
|
@ -120,23 +120,29 @@ class Procedure < ActiveRecord::Base
|
|||
return procedure if procedure.save
|
||||
end
|
||||
|
||||
def brouillon?
|
||||
published_at.nil?
|
||||
end
|
||||
|
||||
def publish!(path)
|
||||
self.update_attributes!({ published_at: Time.now, archived_at: nil })
|
||||
ProcedurePath.create!(path: path, procedure: self, administrateur: self.administrateur)
|
||||
end
|
||||
|
||||
# FIXME: remove once the published colummn has been deleted
|
||||
def published?
|
||||
published_at.present?
|
||||
def publiee?
|
||||
published_at.present? && archived_at.nil?
|
||||
end
|
||||
|
||||
def archive
|
||||
self.update_attributes!(archived_at: Time.now)
|
||||
end
|
||||
|
||||
# FIXME: remove once the archived colummn has been deleted
|
||||
def archived?
|
||||
archived_at.present?
|
||||
def archivee?
|
||||
published_at.present? && archived_at.present?
|
||||
end
|
||||
|
||||
def publiee_ou_archivee?
|
||||
publiee? || archivee?
|
||||
end
|
||||
|
||||
def total_dossier
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
= procedure.created_at_fr
|
||||
%td
|
||||
= link_to('Cloner', admin_procedure_clone_path(procedure.id), 'data-method' => :put, class: 'btn-sm btn-primary clone-btn')
|
||||
- unless procedure.published? || procedure.archived?
|
||||
- unless procedure.publiee_ou_archivee?
|
||||
= link_to('X', url_for(controller: 'admin/procedures', action: :destroy, id: procedure.id), 'data-method' => :delete, class: 'btn-sm btn-danger')
|
||||
|
||||
= smart_listing.paginate
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
%button.close{ "aria-label" => "Close", "data-dismiss" => "modal", :type => "button" }
|
||||
%span{ "aria-hidden" => "true" } ×
|
||||
%h4#myModalLabel.modal-title
|
||||
= @procedure.archived? ? 'Réactiver' : 'Publier'
|
||||
= @procedure.archivee? ? 'Réactiver' : 'Publier'
|
||||
la procédure
|
||||
%span#publish-modal-title
|
||||
.modal-body
|
||||
Vous vous apprêtez à
|
||||
= @procedure.archived? ? 'republier' : 'publier'
|
||||
= @procedure.archivee? ? 'republier' : 'publier'
|
||||
votre procédure au public.
|
||||
- unless @procedure.archived?
|
||||
- unless @procedure.archivee?
|
||||
%b
|
||||
Elle ne pourra plus être modifiée à l'issue de cette publication.
|
||||
%br
|
||||
|
@ -42,7 +42,7 @@
|
|||
#path_is_invalid.text-danger.center.message
|
||||
= t('activerecord.errors.models.procedure_path.attributes.path.format')
|
||||
.modal-footer
|
||||
= submit_tag "#{@procedure.archived? ? 'Réactiver' : 'Publier'}", class: %w(btn btn btn-success),
|
||||
= submit_tag "#{@procedure.archivee? ? 'Réactiver' : 'Publier'}", class: %w(btn btn btn-success),
|
||||
id: 'publish',
|
||||
disabled: :disabled
|
||||
= button_tag 'Annuler', class: %w(btn btn btn-default), id: 'cancel', data: { dismiss: 'modal' }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.row.white-back
|
||||
#procedure_show
|
||||
- unless @facade.procedure.published?
|
||||
- if @facade.procedure.brouillon?
|
||||
- if @facade.procedure.gestionnaires.size == 0
|
||||
%a.action_button.btn.btn-success#publish-procedure{ 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.' }
|
||||
%i.fa.fa-eraser
|
||||
|
@ -18,15 +18,15 @@
|
|||
|
||||
= render partial: '/admin/procedures/modal_transfer'
|
||||
|
||||
- if @facade.procedure.archived?
|
||||
- if @facade.procedure.archivee?
|
||||
%a#reenable.btn.btn-small.btn-default.text-info{ "data-target" => "#publish-modal", "data-toggle" => "modal", :type => "button", style: 'float: right; margin-top: 10px;' }
|
||||
%i.fa.fa-eraser
|
||||
Réactiver
|
||||
|
||||
= render partial: '/admin/procedures/modal_publish'
|
||||
|
||||
- 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
|
||||
- elsif @facade.procedure.publiee?
|
||||
= form_tag admin_procedure_archive_path(procedure_id: @facade.procedure.id, archive: !@facade.procedure.archivee?), method: :put, style: 'float: right; margin-top: 10px;' do
|
||||
%button#archive.btn.btn-small.btn-default.text-info{ type: :button }
|
||||
%i.fa.fa-eraser
|
||||
Archiver
|
||||
|
@ -46,7 +46,7 @@
|
|||
%div
|
||||
%h3 Lien procédure
|
||||
%div{ style: 'margin-left: 3%;' }
|
||||
- if @facade.procedure.published?
|
||||
- if @facade.procedure.publiee_ou_archivee?
|
||||
= link_to @facade.procedure.lien, @facade.procedure.lien, target: '_blank'
|
||||
- else
|
||||
%b
|
||||
|
@ -130,7 +130,7 @@
|
|||
- else
|
||||
= pie_chart @facade.dossiers_for_pie_highchart
|
||||
|
||||
- if @facade.procedure.published? || @facade.procedure.archived?
|
||||
- if @facade.procedure.publiee_ou_archivee?
|
||||
%h3 Supprimer la procédure
|
||||
.alert.alert-danger
|
||||
%p
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
= admin.last_sign_in_at.localtime.strftime('%d/%m/%Y')
|
||||
)
|
||||
%td
|
||||
= admin.procedures.published.count
|
||||
= admin.procedures.publiees.count
|
||||
%td
|
||||
- total_dossier = 0
|
||||
- admin.procedures.each do |procedure| total_dossier += procedure.dossiers.state_not_brouillon.count end
|
||||
|
|
|
@ -13,19 +13,19 @@
|
|||
.procedure-list-element{ class: @draft_class }
|
||||
Brouillons
|
||||
.badge.progress-bar-default
|
||||
= current_administrateur.procedures.not_published.not_archived.count
|
||||
= current_administrateur.procedures.brouillons.count
|
||||
|
||||
%a#active-procedures{ :href => "#{url_for :admin_procedures}" }
|
||||
.procedure-list-element{ class: @active_class }
|
||||
Actives
|
||||
.badge.progress-bar-success
|
||||
= current_administrateur.procedures.published.not_archived.count
|
||||
= current_administrateur.procedures.publiees.count
|
||||
|
||||
%a#archived-procedures{ :href => "#{url_for :admin_procedures_archived}" }
|
||||
.procedure-list-element{ class: @archived_class }
|
||||
Archivées
|
||||
.badge.progress-bar-purple
|
||||
= current_administrateur.procedures.archived.count
|
||||
= current_administrateur.procedures.archivees.count
|
||||
|
||||
.split-hr-left
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
%ul.numbers
|
||||
%li.number
|
||||
.number-value
|
||||
= number_with_delimiter(Procedure.published.count, :locale => :fr)
|
||||
= number_with_delimiter(Procedure.publiee_ou_archivee.count, :locale => :fr)
|
||||
.number-label<
|
||||
procédures
|
||||
%br<>
|
||||
|
|
|
@ -42,5 +42,5 @@
|
|||
- elsif !@dossier.draft?
|
||||
= render partial: '/layouts/modifications_terminees'
|
||||
- else
|
||||
= submit_tag 'Soumettre mon dossier', id: 'suivant', name: 'submit[nouveaux]', class: 'btn btn btn-success', style: 'float: right;', disabled: @procedure.archived?, data: { disable_with: 'Soumettre votre dossier', submit: true }
|
||||
= submit_tag 'Enregistrer un brouillon', id: 'brouillon', name: 'submit[brouillon]', class: 'btn btn-xs btn-default', style: 'float: right; margin-right: 10px; margin-top: 6px;', disabled: @procedure.archived?, data: { disable_with: 'Enregistrer un brouillon', submit: true }
|
||||
= submit_tag 'Soumettre mon dossier', id: 'suivant', name: 'submit[nouveaux]', class: 'btn btn btn-success', style: 'float: right;', disabled: @procedure.archivee?, data: { disable_with: 'Soumettre votre dossier', submit: true }
|
||||
= submit_tag 'Enregistrer un brouillon', id: 'brouillon', name: 'submit[brouillon]', class: 'btn btn-xs btn-default', style: 'float: right; margin-right: 10px; margin-top: 6px;', disabled: @procedure.archivee?, data: { disable_with: 'Enregistrer un brouillon', submit: true }
|
||||
|
|
|
@ -2,7 +2,7 @@ class AutoArchiveProcedureWorker
|
|||
include Sidekiq::Worker
|
||||
|
||||
def perform(*args)
|
||||
Procedure.not_archived.where("auto_archive_on <= ?", Date.today).each do |procedure|
|
||||
Procedure.publiees.where("auto_archive_on <= ?", Date.today).each do |procedure|
|
||||
procedure.dossiers.state_en_construction.each do |dossier|
|
||||
dossier.received!
|
||||
end
|
||||
|
|
|
@ -297,7 +297,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
let(:procedure_path) { 'new_path' }
|
||||
|
||||
it 'publish the given procedure' do
|
||||
expect(procedure.published?).to be_truthy
|
||||
expect(procedure.publiee?).to be_truthy
|
||||
expect(procedure.path).to eq(procedure_path)
|
||||
expect(response.status).to eq 200
|
||||
expect(flash[:notice]).to have_content 'Procédure publiée'
|
||||
|
@ -308,15 +308,14 @@ describe Admin::ProceduresController, type: :controller do
|
|||
let(:procedure_path) { procedure2.path }
|
||||
|
||||
it 'publish the given procedure' do
|
||||
expect(procedure.published?).to be_truthy
|
||||
expect(procedure.publiee?).to be_truthy
|
||||
expect(procedure.path).to eq(procedure_path)
|
||||
expect(response.status).to eq 200
|
||||
expect(flash[:notice]).to have_content 'Procédure publiée'
|
||||
end
|
||||
|
||||
it 'archive previous procedure' do
|
||||
expect(procedure2.published?).to be_truthy
|
||||
expect(procedure2.archived?).to be_truthy
|
||||
expect(procedure2.archivee?).to be_truthy
|
||||
expect(procedure2.path).to be_nil
|
||||
end
|
||||
end
|
||||
|
@ -325,14 +324,14 @@ describe Admin::ProceduresController, type: :controller do
|
|||
let(:procedure_path) { procedure3.path }
|
||||
|
||||
it 'does not publish the given procedure' do
|
||||
expect(procedure.published?).to be_falsey
|
||||
expect(procedure.publiee?).to be_falsey
|
||||
expect(procedure.path).to be_nil
|
||||
expect(response.status).to eq 200
|
||||
end
|
||||
|
||||
it 'previous procedure remains published' do
|
||||
expect(procedure2.published?).to be_truthy
|
||||
expect(procedure2.archived?).to be_falsey
|
||||
expect(procedure2.publiee?).to be_truthy
|
||||
expect(procedure2.archivee?).to be_falsey
|
||||
expect(procedure2.path).to match(/fake_path/)
|
||||
end
|
||||
end
|
||||
|
@ -341,7 +340,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
let(:procedure_path) { 'Invalid Procedure Path' }
|
||||
|
||||
it 'does not publish the given procedure' do
|
||||
expect(procedure.published?).to be_falsey
|
||||
expect(procedure.publiee?).to be_falsey
|
||||
expect(procedure.path).to be_nil
|
||||
expect(response).to redirect_to :admin_procedures
|
||||
expect(flash[:alert]).to have_content 'Lien de la procédure invalide'
|
||||
|
@ -368,7 +367,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
describe 'PUT #archive' do
|
||||
let(:procedure) { create(:procedure, administrateur: admin) }
|
||||
let(:procedure) { create(:procedure, :published, administrateur: admin) }
|
||||
|
||||
context 'when admin is the owner of the procedure' do
|
||||
before do
|
||||
|
@ -377,7 +376,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
context 'when owner want archive procedure' do
|
||||
it { expect(procedure.archived?).to be_truthy }
|
||||
it { expect(procedure.archivee?).to be_truthy }
|
||||
it { expect(response).to redirect_to :admin_procedures }
|
||||
it { expect(flash[:notice]).to have_content 'Procédure archivée' }
|
||||
end
|
||||
|
@ -388,7 +387,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
procedure.reload
|
||||
end
|
||||
|
||||
it { expect(procedure.archived?).to be_falsey }
|
||||
it { expect(procedure.archivee?).to be_falsey }
|
||||
it { expect(response.status).to eq 200 }
|
||||
it { expect(flash[:notice]).to have_content 'Procédure publiée' }
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ describe Users::DescriptionController, type: :controller, vcr: {cassette_name: '
|
|||
let(:archived_at) { nil }
|
||||
let(:state) { 'initiated' }
|
||||
|
||||
let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_datetime, cerfa_flag: true, archived_at: archived_at) }
|
||||
let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_datetime, cerfa_flag: true, published_at: Time.now, archived_at: archived_at) }
|
||||
let(:dossier) { create(:dossier, procedure: procedure, user: owner_user, state: state) }
|
||||
|
||||
let(:dossier_id) { dossier.id }
|
||||
|
|
|
@ -243,6 +243,48 @@ describe Procedure do
|
|||
end
|
||||
end
|
||||
|
||||
describe "#brouillon?" do
|
||||
let(:procedure_brouillon) { Procedure.new() }
|
||||
let(:procedure_publiee) { Procedure.new(published_at: Time.now) }
|
||||
let(:procedure_archivee) { Procedure.new(published_at: Time.now, archived_at: Time.now) }
|
||||
|
||||
it { expect(procedure_brouillon.brouillon?).to be_truthy }
|
||||
it { expect(procedure_publiee.brouillon?).to be_falsey }
|
||||
it { expect(procedure_archivee.brouillon?).to be_falsey }
|
||||
end
|
||||
|
||||
describe "#publiee?" do
|
||||
let(:procedure_brouillon) { Procedure.new() }
|
||||
let(:procedure_publiee) { Procedure.new(published_at: Time.now) }
|
||||
let(:procedure_archivee) { Procedure.new(published_at: Time.now, archived_at: Time.now) }
|
||||
|
||||
it { expect(procedure_brouillon.publiee?).to be_falsey }
|
||||
it { expect(procedure_publiee.publiee?).to be_truthy }
|
||||
it { expect(procedure_archivee.publiee?).to be_falsey }
|
||||
end
|
||||
|
||||
describe "#archivee?" do
|
||||
let(:procedure_brouillon) { Procedure.new() }
|
||||
let(:procedure_publiee) { Procedure.new(published_at: Time.now) }
|
||||
let(:procedure_archivee) { Procedure.new(published_at: Time.now, archived_at: Time.now) }
|
||||
let(:procedure_batarde) { Procedure.new(published_at: nil, archived_at: Time.now) }
|
||||
|
||||
it { expect(procedure_brouillon.archivee?).to be_falsey }
|
||||
it { expect(procedure_publiee.archivee?).to be_falsey }
|
||||
it { expect(procedure_archivee.archivee?).to be_truthy }
|
||||
it { expect(procedure_batarde.archivee?).to be_falsey }
|
||||
end
|
||||
|
||||
describe "#publiee_ou_archivee?" do
|
||||
let(:procedure_brouillon) { Procedure.new() }
|
||||
let(:procedure_publiee) { Procedure.new(published_at: Time.now) }
|
||||
let(:procedure_archivee) { Procedure.new(published_at: Time.now, archived_at: Time.now) }
|
||||
|
||||
it { expect(procedure_brouillon.publiee_ou_archivee?).to be_falsey }
|
||||
it { expect(procedure_publiee.publiee_ou_archivee?).to be_truthy }
|
||||
it { expect(procedure_archivee.publiee_ou_archivee?).to be_truthy }
|
||||
end
|
||||
|
||||
describe 'archive' do
|
||||
let(:procedure) { create(:procedure, :published) }
|
||||
let(:procedure_path) { ProcedurePath.find(procedure.procedure_path.id) }
|
||||
|
@ -253,8 +295,7 @@ describe Procedure do
|
|||
procedure.reload
|
||||
end
|
||||
|
||||
it { expect(procedure.published?).to be_truthy }
|
||||
it { expect(procedure.archived?).to be_truthy }
|
||||
it { expect(procedure.archivee?).to be_truthy }
|
||||
it { expect(procedure.archived_at).to eq(now) }
|
||||
|
||||
after do
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AutoArchiveProcedureWorker, type: :worker do
|
||||
let!(:procedure) { create(:procedure, archived_at: nil, auto_archive_on: nil )}
|
||||
let!(:procedure_hier) { create(:procedure, archived_at: nil, auto_archive_on: 1.day.ago )}
|
||||
let!(:procedure_aujourdhui) { create(:procedure, archived_at: nil, auto_archive_on: Date.today )}
|
||||
let!(:procedure_demain) { create(:procedure, archived_at: nil, auto_archive_on: 1.day.from_now )}
|
||||
let!(:procedure) { create(:procedure, published_at: Time.now, archived_at: nil, auto_archive_on: nil )}
|
||||
let!(:procedure_hier) { create(:procedure, published_at: Time.now, archived_at: nil, auto_archive_on: 1.day.ago )}
|
||||
let!(:procedure_aujourdhui) { create(:procedure, published_at: Time.now, archived_at: nil, auto_archive_on: Date.today )}
|
||||
let!(:procedure_demain) { create(:procedure, published_at: Time.now, archived_at: nil, auto_archive_on: 1.day.from_now )}
|
||||
|
||||
subject { AutoArchiveProcedureWorker.new.perform }
|
||||
|
||||
|
@ -14,7 +14,7 @@ RSpec.describe AutoArchiveProcedureWorker, type: :worker do
|
|||
procedure.reload
|
||||
end
|
||||
|
||||
it { expect(procedure.archived?).to eq false }
|
||||
it { expect(procedure.archivee?).to eq false }
|
||||
end
|
||||
|
||||
context "when procedures have auto_archive_on set on yesterday or today" do
|
||||
|
@ -49,8 +49,8 @@ RSpec.describe AutoArchiveProcedureWorker, type: :worker do
|
|||
it { expect(dossier8.state).to eq 'without_continuation' }
|
||||
it { expect(dossier9.state).to eq 'received' }
|
||||
|
||||
it { expect(procedure_hier.archived?).to eq true }
|
||||
it { expect(procedure_aujourdhui.archived?).to eq true }
|
||||
it { expect(procedure_hier.archivee?).to eq true }
|
||||
it { expect(procedure_aujourdhui.archivee?).to eq true }
|
||||
end
|
||||
|
||||
context "when procedures have auto_archive_on set on future" do
|
||||
|
@ -58,6 +58,6 @@ RSpec.describe AutoArchiveProcedureWorker, type: :worker do
|
|||
subject
|
||||
end
|
||||
|
||||
it { expect(procedure_demain.archived?).to eq false }
|
||||
it { expect(procedure_demain.archivee?).to eq false }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue