specs: rename Dossier's with_all_champs to with_populated_champs

This better reflects what the trait is used for, and disambiguate it
from the similarly named trait in the Procedure factory.
This commit is contained in:
Pierre de La Morinerie 2021-11-03 14:52:53 +00:00
parent 6c60c940d4
commit b06183d7bf
8 changed files with 19 additions and 19 deletions

View file

@ -256,7 +256,7 @@ describe API::V1::DossiersController do
describe 'repetition' do describe 'repetition' do
let(:procedure) { create(:procedure, :with_repetition, administrateur: admin) } let(:procedure) { create(:procedure, :with_repetition, administrateur: admin) }
let(:dossier) { create(:dossier, :en_construction, :with_all_champs, procedure: procedure) } let(:dossier) { create(:dossier, :en_construction, :with_populated_champs, procedure: procedure) }
subject { super().first[:rows] } subject { super().first[:rows] }

View file

@ -5,8 +5,8 @@ describe API::V2::GraphqlController do
let(:dossier) do let(:dossier) do
dossier = create(:dossier, dossier = create(:dossier,
:en_construction, :en_construction,
:with_all_champs, :with_populated_champs,
:with_all_annotations, :with_populated_annotations,
:with_individual, :with_individual,
procedure: procedure) procedure: procedure)
create(:commentaire, :with_file, dossier: dossier, email: 'test@test.com') create(:commentaire, :with_file, dossier: dossier, email: 'test@test.com')

View file

@ -560,8 +560,8 @@ describe Instructeurs::DossiersController, type: :controller do
let(:dossier) do let(:dossier) do
create(:dossier, create(:dossier,
:accepte, :accepte,
:with_all_champs, :with_populated_champs,
:with_all_annotations, :with_populated_annotations,
:with_motivation, :with_motivation,
:with_entreprise, :with_entreprise,
:with_commentaires, procedure: procedure) :with_commentaires, procedure: procedure)
@ -593,7 +593,7 @@ describe Instructeurs::DossiersController, type: :controller do
build(:type_de_champ_repetition, :with_types_de_champ, position: 3) build(:type_de_champ_repetition, :with_types_de_champ, position: 3)
], instructeurs: instructeurs) ], instructeurs: instructeurs)
end end
let(:dossier) { create(:dossier, :en_construction, :with_all_annotations, procedure: procedure) } let(:dossier) { create(:dossier, :en_construction, :with_populated_annotations, procedure: procedure) }
let(:another_instructeur) { create(:instructeur) } let(:another_instructeur) { create(:instructeur) }
let(:now) { Time.zone.parse('01/01/2100') } let(:now) { Time.zone.parse('01/01/2100') }

View file

@ -1,10 +1,10 @@
describe RechercheController, type: :controller do describe RechercheController, type: :controller do
let(:dossier) { create(:dossier, :en_construction, :with_all_annotations) } let(:dossier) { create(:dossier, :en_construction, :with_populated_annotations) }
let(:dossier2) { create(:dossier, :en_construction, procedure: dossier.procedure) } let(:dossier2) { create(:dossier, :en_construction, procedure: dossier.procedure) }
let(:instructeur) { create(:instructeur) } let(:instructeur) { create(:instructeur) }
let(:dossier_with_expert) { avis.dossier } let(:dossier_with_expert) { avis.dossier }
let(:avis) { create(:avis, dossier: create(:dossier, :en_construction, :with_all_annotations)) } let(:avis) { create(:avis, dossier: create(:dossier, :en_construction, :with_populated_annotations)) }
let(:user) { instructeur.user } let(:user) { instructeur.user }

View file

@ -879,7 +879,7 @@ describe Users::DossiersController, type: :controller do
let(:dossier) do let(:dossier) do
create(:dossier, create(:dossier,
:accepte, :accepte,
:with_all_champs, :with_populated_champs,
:with_motivation, :with_motivation,
:with_commentaires, :with_commentaires,
procedure: procedure, procedure: procedure,

View file

@ -212,7 +212,7 @@ FactoryBot.define do
end end
end end
trait :with_all_champs do trait :with_populated_champs do
after(:create) do |dossier, _evaluator| after(:create) do |dossier, _evaluator|
dossier.champs = dossier.types_de_champ.map do |type_de_champ| dossier.champs = dossier.types_de_champ.map do |type_de_champ|
build(:"champ_#{type_de_champ.type_champ}", dossier: dossier, type_de_champ: type_de_champ) build(:"champ_#{type_de_champ.type_champ}", dossier: dossier, type_de_champ: type_de_champ)
@ -221,7 +221,7 @@ FactoryBot.define do
end end
end end
trait :with_all_annotations do trait :with_populated_annotations do
after(:create) do |dossier, _evaluator| after(:create) do |dossier, _evaluator|
dossier.champs_private = dossier.types_de_champ_private.map do |type_de_champ| dossier.champs_private = dossier.types_de_champ_private.map do |type_de_champ|
build(:"champ_#{type_de_champ.type_champ}", private: true, dossier: dossier, type_de_champ: type_de_champ) build(:"champ_#{type_de_champ.type_champ}", private: true, dossier: dossier, type_de_champ: type_de_champ)

View file

@ -32,7 +32,7 @@ describe ProcedureExportService do
end end
describe 'Dossiers sheet' do describe 'Dossiers sheet' do
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure) } let!(:dossier) { create(:dossier, :en_instruction, :with_populated_champs, :with_individual, procedure: procedure) }
let(:nominal_headers) do let(:nominal_headers) do
[ [
@ -119,7 +119,7 @@ describe ProcedureExportService do
describe 'Etablissement sheet' do describe 'Etablissement sheet' do
let(:procedure) { create(:procedure, :published, :with_all_champs) } let(:procedure) { create(:procedure, :published, :with_all_champs) }
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_entreprise, procedure: procedure) } let!(:dossier) { create(:dossier, :en_instruction, :with_populated_champs, :with_entreprise, procedure: procedure) }
let(:dossier_etablissement) { etablissements_sheet.data[1] } let(:dossier_etablissement) { etablissements_sheet.data[1] }
let(:champ_etablissement) { etablissements_sheet.data[0] } let(:champ_etablissement) { etablissements_sheet.data[0] }
@ -309,7 +309,7 @@ describe ProcedureExportService do
end end
describe 'Avis sheet' do describe 'Avis sheet' do
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure) } let!(:dossier) { create(:dossier, :en_instruction, :with_populated_champs, :with_individual, procedure: procedure) }
let!(:avis) { create(:avis, :with_answer, dossier: dossier) } let!(:avis) { create(:avis, :with_answer, dossier: dossier) }
it 'should have headers' do it 'should have headers' do
@ -332,8 +332,8 @@ describe ProcedureExportService do
describe 'Repetitions sheet' do describe 'Repetitions sheet' do
let!(:dossiers) do let!(:dossiers) do
[ [
create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure), create(:dossier, :en_instruction, :with_populated_champs, :with_individual, procedure: procedure),
create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure) create(:dossier, :en_instruction, :with_populated_champs, :with_individual, procedure: procedure)
] ]
end end
let(:champ_repetition) { dossiers.first.champs.find { |champ| champ.type_champ == 'repetition' } } let(:champ_repetition) { dossiers.first.champs.find { |champ| champ.type_champ == 'repetition' } }
@ -381,7 +381,7 @@ describe ProcedureExportService do
end end
context 'with non unique labels' do context 'with non unique labels' do
let(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure) } let(:dossier) { create(:dossier, :en_instruction, :with_populated_champs, :with_individual, procedure: procedure) }
let(:champ_repetition) { dossier.champs.find { |champ| champ.type_champ == 'repetition' } } let(:champ_repetition) { dossier.champs.find { |champ| champ.type_champ == 'repetition' } }
let(:type_de_champ_repetition) { create(:type_de_champ_repetition, procedure: procedure, libelle: champ_repetition.libelle) } let(:type_de_champ_repetition) { create(:type_de_champ_repetition, procedure: procedure, libelle: champ_repetition.libelle) }
let!(:another_champ_repetition) { create(:champ_repetition, type_de_champ: type_de_champ_repetition, dossier: dossier) } let!(:another_champ_repetition) { create(:champ_repetition, type_de_champ: type_de_champ_repetition, dossier: dossier) }

View file

@ -1,7 +1,7 @@
describe 'user access to the list of their dossiers' do describe 'user access to the list of their dossiers' do
let(:user) { create(:user) } let(:user) { create(:user) }
let!(:dossier_brouillon) { create(:dossier, user: user) } let!(:dossier_brouillon) { create(:dossier, user: user) }
let!(:dossier_en_construction) { create(:dossier, :with_all_champs, :en_construction, user: user) } let!(:dossier_en_construction) { create(:dossier, :with_populated_champs, :en_construction, user: user) }
let!(:dossier_en_instruction) { create(:dossier, :en_instruction, user: user) } let!(:dossier_en_instruction) { create(:dossier, :en_instruction, user: user) }
let!(:dossier_archived) { create(:dossier, :en_instruction, :archived, user: user) } let!(:dossier_archived) { create(:dossier, :en_instruction, :archived, user: user) }
let(:dossiers_per_page) { 25 } let(:dossiers_per_page) { 25 }
@ -121,7 +121,7 @@ describe 'user access to the list of their dossiers' do
end end
context "when user search for something inside the dossier" do context "when user search for something inside the dossier" do
let(:dossier_en_construction2) { create(:dossier, :with_all_champs, :en_construction, user: user) } let(:dossier_en_construction2) { create(:dossier, :with_populated_champs, :en_construction, user: user) }
before do before do
page.find_by_id('q').set(dossier_en_construction.champs.first.value) page.find_by_id('q').set(dossier_en_construction.champs.first.value)
end end