use drop_down_options when possible
This commit is contained in:
parent
77b754a08d
commit
8b5f689a67
14 changed files with 81 additions and 92 deletions
|
@ -78,13 +78,13 @@ describe Champs::LinkedDropDownListChamp do
|
|||
end
|
||||
|
||||
describe '#mandatory_and_blank' do
|
||||
let(:value) { "--Primary--\r\nSecondary" }
|
||||
let(:options) { ["--Primary--", "Secondary"] }
|
||||
|
||||
subject { described_class.new }
|
||||
before { allow(subject).to receive(:type_de_champ).and_return(type_de_champ) }
|
||||
|
||||
context 'when the champ is not mandatory' do
|
||||
let(:type_de_champ) { build(:type_de_champ_linked_drop_down_list, mandatory: false, drop_down_list_value: value) }
|
||||
let(:type_de_champ) { build(:type_de_champ_linked_drop_down_list, mandatory: false, drop_down_options: options) }
|
||||
|
||||
it 'blank is fine' do
|
||||
is_expected.not_to be_mandatory_blank
|
||||
|
@ -92,7 +92,7 @@ describe Champs::LinkedDropDownListChamp do
|
|||
end
|
||||
|
||||
context 'when the champ is mandatory' do
|
||||
let(:type_de_champ) { build(:type_de_champ_linked_drop_down_list, mandatory: true, drop_down_list_value: value) }
|
||||
let(:type_de_champ) { build(:type_de_champ_linked_drop_down_list, mandatory: true, drop_down_options: options) }
|
||||
|
||||
context 'when there is no value' do
|
||||
it { is_expected.to be_mandatory_blank }
|
||||
|
@ -112,7 +112,7 @@ describe Champs::LinkedDropDownListChamp do
|
|||
end
|
||||
|
||||
context 'when there is nothing to select for the secondary value' do
|
||||
let(:value) { "--A--\nAbbott\nAbelard\n--B--\n--C--\nCynthia" }
|
||||
let(:options) { ["--A--", "Abbott", "Abelard", "--B--", "--C--", "Cynthia"] }
|
||||
before { subject.primary_value = 'B' }
|
||||
|
||||
it { is_expected.not_to be_mandatory_blank }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Champs::MultipleDropDownListChamp do
|
||||
let(:type_de_champ) { build(:type_de_champ_multiple_drop_down_list, drop_down_list_value: "val1\r\nval2\r\nval3\r\n[brackets] val4") }
|
||||
let(:type_de_champ) { build(:type_de_champ_multiple_drop_down_list, drop_down_options: ["val1", "val2", "val3", "[brackets] val4"]) }
|
||||
let(:value) { nil }
|
||||
let(:champ) { Champs::MultipleDropDownListChamp.new(value:, dossier: build(:dossier)) }
|
||||
before do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue