Always use factories in spec
This commit is contained in:
parent
793768684e
commit
0c10f2bd47
2 changed files with 10 additions and 10 deletions
|
@ -47,16 +47,16 @@ describe DropDownList do
|
|||
end
|
||||
|
||||
context 'when multiple' do
|
||||
let(:type_de_champ) { TypeDeChamp.new(type_champ: 'multiple_drop_down_list') }
|
||||
let(:type_de_champ) { build(:type_de_champ_public, type_champ: 'multiple_drop_down_list') }
|
||||
let(:champ) { type_de_champ.champ.build(value: '["1","2"]').decorate }
|
||||
|
||||
let(:champ) { Champ.new(value: '["1","2"]').decorate }
|
||||
it { expect(dropdownlist.selected_options(champ)).to match(['1', '2']) }
|
||||
end
|
||||
|
||||
context 'when simple' do
|
||||
let(:type_de_champ) { TypeDeChamp.new(type_champ: 'drop_down_list') }
|
||||
let(:type_de_champ) { build(:type_de_champ_public, type_champ: 'drop_down_list') }
|
||||
let(:champ) { type_de_champ.champ.build(value: '1').decorate }
|
||||
|
||||
let(:champ) { Champ.new(value: '1').decorate }
|
||||
it { expect(dropdownlist.selected_options(champ)).to match(['1']) }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ChampsService do
|
||||
let!(:champ) { Champ.create(value: 'toto', type_de_champ: TypeDeChamp.new) }
|
||||
let!(:champ_mandatory_empty) { Champ.create(type_de_champ: TypeDeChamp.new(libelle: 'mandatory', mandatory: true)) }
|
||||
let!(:champ_datetime) do
|
||||
champ_datetime = TypeDeChamp.new(type_champ: 'datetime')
|
||||
Champ.create(type_de_champ: champ_datetime)
|
||||
end
|
||||
let(:type_de_champ) { create(:type_de_champ_public) }
|
||||
let(:type_de_champ_mandatory) { create(:type_de_champ_public, libelle: 'mandatory', mandatory: true) }
|
||||
let(:type_de_champ_datetime) { create(:type_de_champ_public, type_champ: :datetime) }
|
||||
let!(:champ) { type_de_champ.champ.create(value: 'toto') }
|
||||
let!(:champ_mandatory_empty) { type_de_champ_mandatory.champ.create }
|
||||
let!(:champ_datetime) { type_de_champ_datetime.champ.create }
|
||||
let!(:champs) { [champ, champ_mandatory_empty, champ_datetime] }
|
||||
|
||||
describe 'save_champs' do
|
||||
|
|
Loading…
Reference in a new issue