specs: remove old pieces_justificative from specs and factories
This commit is contained in:
parent
f69f325236
commit
ffe081c1f2
8 changed files with 15 additions and 55 deletions
|
@ -248,7 +248,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
describe 'PUT #update' do
|
||||
let!(:procedure) { create(:procedure, :with_type_de_champ, :with_two_type_de_piece_justificative, administrateur: admin) }
|
||||
let!(:procedure) { create(:procedure, :with_type_de_champ, administrateur: admin) }
|
||||
|
||||
context 'when administrateur is not connected' do
|
||||
before do
|
||||
|
@ -302,7 +302,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
context 'when procedure is brouillon' do
|
||||
let(:procedure) { create(:procedure_with_dossiers, :with_path, :with_type_de_champ, :with_two_type_de_piece_justificative, administrateur: admin) }
|
||||
let(:procedure) { create(:procedure_with_dossiers, :with_path, :with_type_de_champ, administrateur: admin) }
|
||||
let!(:dossiers_count) { procedure.dossiers.count }
|
||||
|
||||
describe 'dossiers are dropped' do
|
||||
|
@ -316,7 +316,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
context 'when procedure is published' do
|
||||
let(:procedure) { create(:procedure, :with_type_de_champ, :with_two_type_de_piece_justificative, :published, administrateur: admin) }
|
||||
let(:procedure) { create(:procedure, :with_type_de_champ, :published, administrateur: admin) }
|
||||
|
||||
subject { update_procedure }
|
||||
|
||||
|
@ -774,7 +774,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
describe 'PATCH #monavis' do
|
||||
let!(:procedure) { create(:procedure, :with_type_de_champ, :with_two_type_de_piece_justificative, administrateur: admin) }
|
||||
let!(:procedure) { create(:procedure, administrateur: admin) }
|
||||
let(:procedure_params) {
|
||||
{
|
||||
monavis_embed: monavis_embed
|
||||
|
@ -835,7 +835,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
context 'when procedure is published' do
|
||||
let(:procedure) { create(:procedure, :with_type_de_champ, :with_two_type_de_piece_justificative, :published, administrateur: admin) }
|
||||
let(:procedure) { create(:procedure, :published, administrateur: admin) }
|
||||
|
||||
subject { update_monavis }
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ FactoryBot.define do
|
|||
|
||||
before(:create) do |dossier, _evaluator|
|
||||
if !dossier.procedure
|
||||
procedure = create(:procedure, :published, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_type_de_champ_private)
|
||||
procedure = create(:procedure, :published, :with_type_de_champ, :with_type_de_champ_private)
|
||||
dossier.procedure = procedure
|
||||
end
|
||||
end
|
||||
|
|
|
@ -135,17 +135,6 @@ FactoryBot.define do
|
|||
end
|
||||
end
|
||||
|
||||
# Deprecated
|
||||
trait :with_two_type_de_piece_justificative do
|
||||
after(:build) do |procedure, _evaluator|
|
||||
rib = create(:type_de_piece_justificative, :rib, order_place: 1)
|
||||
msa = create(:type_de_piece_justificative, :msa, order_place: 2)
|
||||
|
||||
procedure.types_de_piece_justificative << rib
|
||||
procedure.types_de_piece_justificative << msa
|
||||
end
|
||||
end
|
||||
|
||||
trait :published do
|
||||
after(:build) do |procedure, _evaluator|
|
||||
procedure.publish!(procedure.administrateurs.first, generate(:published_path), procedure.lien_site_web)
|
||||
|
|
|
@ -11,7 +11,7 @@ feature 'Creating a new dossier:' do
|
|||
end
|
||||
|
||||
context 'when the procedure has identification by individual' do
|
||||
let(:procedure) { create(:procedure, :published, :for_individual, :with_service, :with_type_de_champ, :with_two_type_de_piece_justificative, ask_birthday: ask_birthday) }
|
||||
let(:procedure) { create(:procedure, :published, :for_individual, :with_service, ask_birthday: ask_birthday) }
|
||||
let(:ask_birthday) { false }
|
||||
let(:expected_birthday) { nil }
|
||||
|
||||
|
@ -63,7 +63,7 @@ feature 'Creating a new dossier:' do
|
|||
end
|
||||
|
||||
context 'when identifying through SIRET' do
|
||||
let(:procedure) { create(:procedure, :published, :with_service, :with_type_de_champ, :with_two_type_de_piece_justificative) }
|
||||
let(:procedure) { create(:procedure, :published, :with_service, :with_type_de_champ) }
|
||||
let(:dossier) { procedure.dossiers.last }
|
||||
|
||||
before do
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
describe ActiveStorage::DownloadableFile do
|
||||
let(:tpjs) { [tpj_not_mandatory] }
|
||||
let!(:tpj_not_mandatory) do
|
||||
TypeDePieceJustificative.create(libelle: 'not mandatory', mandatory: false)
|
||||
end
|
||||
let(:procedure) { Procedure.create(types_de_piece_justificative: tpjs) }
|
||||
let(:dossier) { Dossier.create(procedure: procedure) }
|
||||
let(:procedure) { Procedure.create(types_de_piece_justificative: tpjs) }
|
||||
let(:dossier) { Dossier.create(procedure: procedure) }
|
||||
let(:list) { ActiveStorage::DownloadableFile.create_list_from_dossier(dossier) }
|
||||
let(:dossier) { create(:dossier) }
|
||||
|
||||
subject(:list) { ActiveStorage::DownloadableFile.create_list_from_dossier(dossier) }
|
||||
|
||||
describe 'create_list_from_dossier' do
|
||||
context 'when no piece_justificative is present' do
|
||||
|
@ -15,9 +9,8 @@ describe ActiveStorage::DownloadableFile do
|
|||
end
|
||||
|
||||
context 'when there is a piece_justificative' do
|
||||
let (:pj) { create(:champ, :piece_justificative, :with_piece_justificative_file) }
|
||||
before do
|
||||
dossier.champs = [pj]
|
||||
dossier.champs << create(:champ, :piece_justificative, :with_piece_justificative_file)
|
||||
end
|
||||
|
||||
it { expect(list.length).to be 1 }
|
||||
|
|
|
@ -91,22 +91,6 @@ describe Dossier do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#types_de_piece_justificative' do
|
||||
subject { dossier.types_de_piece_justificative }
|
||||
it 'returns list of required piece justificative' do
|
||||
expect(subject.size).to eq(2)
|
||||
expect(subject).to include(TypeDePieceJustificative.find(TypeDePieceJustificative.first.id))
|
||||
end
|
||||
end
|
||||
|
||||
describe '#types_de_piece_justificative' do
|
||||
subject { dossier.types_de_piece_justificative }
|
||||
it 'returns list of required piece justificative' do
|
||||
expect(subject.size).to eq(2)
|
||||
expect(subject).to include(TypeDePieceJustificative.find(TypeDePieceJustificative.first.id))
|
||||
end
|
||||
end
|
||||
|
||||
describe '#build_default_champs' do
|
||||
context 'when dossier is linked to a procedure with type_de_champ_public and private' do
|
||||
let(:dossier) { create(:dossier, user: user) }
|
||||
|
@ -553,12 +537,6 @@ describe Dossier do
|
|||
|
||||
it { is_expected.not_to eq(modif_date) }
|
||||
|
||||
context 'when a piece justificative is modified' do
|
||||
before { dossier.pieces_justificatives << create(:piece_justificative, :contrat) }
|
||||
|
||||
it { is_expected.to eq(modif_date) }
|
||||
end
|
||||
|
||||
context 'when a champ is modified' do
|
||||
before { dossier.champs.first.update_attribute('value', 'yop') }
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/dossiers/brouillon.html.haml', type: :view do
|
||||
let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_notice, for_individual: true) }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
|
||||
let(:procedure) { create(:procedure, :with_type_de_champ, :with_notice, :with_service, for_individual: true) }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
|
||||
let(:footer) { view.content_for(:footer) }
|
||||
|
||||
before do
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/dossiers/demande.html.haml', type: :view do
|
||||
let(:procedure) { create(:procedure, :published, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_type_de_champ_private) }
|
||||
let(:procedure) { create(:procedure, :published, :with_type_de_champ, :with_type_de_champ_private) }
|
||||
let(:dossier) { create(:dossier, :en_construction, :with_entreprise, procedure: procedure) }
|
||||
|
||||
before do
|
||||
|
|
Loading…
Reference in a new issue