small cleaning in column_concern_spec

This commit is contained in:
simon lehericey 2024-11-06 21:23:26 +01:00
parent 32d3ec2dc3
commit 055069755a
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5

View file

@ -1,6 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
describe ColumnsConcern do describe ColumnsConcern do
let(:procedure_id) { procedure.id }
describe '#find_column' do describe '#find_column' do
let(:procedure) { build(:procedure) } let(:procedure) { build(:procedure) }
let(:notifications_column) { procedure.notifications_column } let(:notifications_column) { procedure.notifications_column }
@ -22,7 +24,6 @@ describe ColumnsConcern do
context 'when the procedure can have a SIRET number' do context 'when the procedure can have a SIRET number' do
let(:procedure) { create(:procedure, types_de_champ_public:, types_de_champ_private:) } let(:procedure) { create(:procedure, types_de_champ_public:, types_de_champ_private:) }
let(:procedure_id) { procedure.id }
let(:tdc_1) { procedure.active_revision.types_de_champ_public[0] } let(:tdc_1) { procedure.active_revision.types_de_champ_public[0] }
let(:tdc_2) { procedure.active_revision.types_de_champ_public[1] } let(:tdc_2) { procedure.active_revision.types_de_champ_public[1] }
let(:tdc_private_1) { procedure.active_revision.types_de_champ_private[0] } let(:tdc_private_1) { procedure.active_revision.types_de_champ_private[0] }
@ -106,16 +107,12 @@ describe ColumnsConcern do
let(:surname_field) { Column.new(procedure_id:, label: "Nom", table: "individual", column: "nom", displayable: true, type: :text, value_column: :value, filterable: true) } let(:surname_field) { Column.new(procedure_id:, label: "Nom", table: "individual", column: "nom", displayable: true, type: :text, value_column: :value, filterable: true) }
let(:gender_field) { Column.new(procedure_id:, label: "Civilité", table: "individual", column: "gender", displayable: true, type: :text, value_column: :value, filterable: true) } let(:gender_field) { Column.new(procedure_id:, label: "Civilité", table: "individual", column: "gender", displayable: true, type: :text, value_column: :value, filterable: true) }
let(:procedure) { create(:procedure, :for_individual) } let(:procedure) { create(:procedure, :for_individual) }
let(:procedure_id) { procedure.id }
let(:procedure_presentation) { create(:procedure_presentation, assign_to: assign_to) }
it { is_expected.to include(name_field, surname_field, gender_field) } it { is_expected.to include(name_field, surname_field, gender_field) }
end end
context 'when the procedure is sva' do context 'when the procedure is sva' do
let(:procedure) { create(:procedure, :for_individual, :sva) } let(:procedure) { create(:procedure, :sva) }
let(:procedure_id) { procedure.id }
let(:procedure_presentation) { create(:procedure_presentation, assign_to: assign_to) }
let(:decision_on) { Column.new(procedure_id:, label: "Date décision SVA", table: "self", column: "sva_svr_decision_on", displayable: true, type: :date, value_column: :value, filterable: true) } let(:decision_on) { Column.new(procedure_id:, label: "Date décision SVA", table: "self", column: "sva_svr_decision_on", displayable: true, type: :date, value_column: :value, filterable: true) }
let(:decision_before_field) { Column.new(procedure_id:, label: "Date décision SVA avant", table: "self", column: "sva_svr_decision_before", displayable: false, type: :date, value_column: :value, filterable: true) } let(:decision_before_field) { Column.new(procedure_id:, label: "Date décision SVA avant", table: "self", column: "sva_svr_decision_before", displayable: false, type: :date, value_column: :value, filterable: true) }
@ -124,9 +121,7 @@ describe ColumnsConcern do
end end
context 'when the procedure is svr' do context 'when the procedure is svr' do
let(:procedure) { create(:procedure, :for_individual, :svr) } let(:procedure) { create(:procedure, :svr) }
let(:procedure_id) { procedure.id }
let(:procedure_presentation) { create(:procedure_presentation, assign_to: assign_to) }
let(:decision_on) { Column.new(procedure_id:, label: "Date décision SVR", table: "self", column: "sva_svr_decision_on", displayable: true, type: :date, value_column: :value, filterable: true) } let(:decision_on) { Column.new(procedure_id:, label: "Date décision SVR", table: "self", column: "sva_svr_decision_on", displayable: true, type: :date, value_column: :value, filterable: true) }
let(:decision_before_field) { Column.new(procedure_id:, label: "Date décision SVR avant", table: "self", column: "sva_svr_decision_before", displayable: false, type: :date, value_column: :value, filterable: true) } let(:decision_before_field) { Column.new(procedure_id:, label: "Date décision SVR avant", table: "self", column: "sva_svr_decision_before", displayable: false, type: :date, value_column: :value, filterable: true) }