Spec STI loading champ/type de champ
This commit is contained in:
parent
a9f078265a
commit
9cc6d494a4
19 changed files with 126 additions and 79 deletions
|
@ -369,11 +369,11 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
|
||||
describe "#update_annotations" do
|
||||
let(:champ_multiple_drop_down_list) do
|
||||
create(:type_de_champ, :private, type_champ: 'multiple_drop_down_list', libelle: 'libelle').champ.create
|
||||
create(:type_de_champ_multiple_drop_down_list, :private, libelle: 'libelle').champ.create
|
||||
end
|
||||
|
||||
let(:champ_datetime) do
|
||||
create(:type_de_champ, :private, type_champ: 'datetime', libelle: 'libelle').champ.create
|
||||
create(:type_de_champ_datetime, :private, libelle: 'libelle').champ.create
|
||||
end
|
||||
|
||||
let(:dossier) do
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ChampDecorator do
|
||||
let(:type_de_champ) { create(:type_de_champ, type_champ: type_champ) }
|
||||
let(:type_de_champ) { create(:type_de_champ) }
|
||||
let(:champ) { type_de_champ.champ.create }
|
||||
let(:decorator) { champ.decorate }
|
||||
|
||||
|
@ -9,7 +9,7 @@ describe ChampDecorator do
|
|||
subject { decorator.value }
|
||||
|
||||
describe 'for a checkbox' do
|
||||
let(:type_champ) { :checkbox }
|
||||
let(:type_de_champ) { create(:type_de_champ_checkbox) }
|
||||
|
||||
context 'when value is on' do
|
||||
before { champ.update value: 'on' }
|
||||
|
@ -22,7 +22,7 @@ describe ChampDecorator do
|
|||
end
|
||||
|
||||
describe 'for a engagement' do
|
||||
let(:type_champ) { :engagement }
|
||||
let(:type_de_champ) { create(:type_de_champ_engagement) }
|
||||
|
||||
context 'when value is on' do
|
||||
before { champ.update value: 'on' }
|
||||
|
@ -35,7 +35,7 @@ describe ChampDecorator do
|
|||
end
|
||||
|
||||
describe 'for a multiple_drop_down_list' do
|
||||
let(:type_champ) { :multiple_drop_down_list }
|
||||
let(:type_de_champ) { create(:type_de_champ_multiple_drop_down_list) }
|
||||
|
||||
context 'when value is an array' do
|
||||
before { champ.update value: '["1", "2"]' }
|
||||
|
@ -49,7 +49,7 @@ describe ChampDecorator do
|
|||
end
|
||||
|
||||
describe "for a date" do
|
||||
let(:type_champ) { :date }
|
||||
let(:type_de_champ) { create(:type_de_champ_date) }
|
||||
|
||||
context "when value is an ISO date" do
|
||||
before { champ.update value: "2017-12-31" }
|
||||
|
@ -67,7 +67,7 @@ describe ChampDecorator do
|
|||
subject { decorator.date_for_input }
|
||||
|
||||
describe "for a date" do
|
||||
let(:type_champ) { :date }
|
||||
let(:type_de_champ) { create(:type_de_champ_date) }
|
||||
|
||||
context "when value is an ISO date" do
|
||||
before { champ.update value: "2017-12-31" }
|
||||
|
@ -81,7 +81,7 @@ describe ChampDecorator do
|
|||
end
|
||||
|
||||
describe "for a datetime" do
|
||||
let(:type_champ) { :date }
|
||||
let(:type_de_champ) { create(:type_de_champ_date) }
|
||||
|
||||
context "when value is an formatted datetime" do
|
||||
before { champ.update value: "2017-12-30 23:17" }
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
FactoryBot.define do
|
||||
factory :champ do
|
||||
type_de_champ { FactoryBot.create(:type_de_champ) }
|
||||
type_de_champ { create(:type_de_champ) }
|
||||
|
||||
trait :checkbox do
|
||||
type_de_champ { FactoryBot.create(:type_de_champ, :checkbox) }
|
||||
type_de_champ { create(:type_de_champ_checkbox) }
|
||||
end
|
||||
|
||||
trait :header_section do
|
||||
type_de_champ { FactoryBot.create(:type_de_champ, :header_section) }
|
||||
type_de_champ { create(:type_de_champ_header_section) }
|
||||
end
|
||||
|
||||
trait :explication do
|
||||
type_de_champ { FactoryBot.create(:type_de_champ, :explication) }
|
||||
type_de_champ { create(:type_de_champ_explication) }
|
||||
end
|
||||
|
||||
trait :dossier_link do
|
||||
type_de_champ { FactoryBot.create(:type_de_champ, :type_dossier_link) }
|
||||
type_de_champ { create(:type_de_champ_dossier_link) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -67,7 +67,7 @@ FactoryBot.define do
|
|||
|
||||
trait :with_datetime do
|
||||
after(:build) do |procedure, _evaluator|
|
||||
type_de_champ = create(:type_de_champ, mandatory: true, type_champ: :datetime)
|
||||
type_de_champ = create(:type_de_champ_datetime, mandatory: true)
|
||||
|
||||
procedure.types_de_champ << type_de_champ
|
||||
end
|
||||
|
@ -75,7 +75,7 @@ FactoryBot.define do
|
|||
|
||||
trait :with_dossier_link do
|
||||
after(:build) do |procedure, _evaluator|
|
||||
type_de_champ = create(:type_de_champ, :type_dossier_link)
|
||||
type_de_champ = create(:type_de_champ_dossier_link)
|
||||
|
||||
procedure.types_de_champ << type_de_champ
|
||||
end
|
||||
|
@ -83,7 +83,7 @@ FactoryBot.define do
|
|||
|
||||
trait :with_yes_no do
|
||||
after(:build) do |procedure, _evaluator|
|
||||
type_de_champ = create(:type_de_champ, :type_yes_no)
|
||||
type_de_champ = create(:type_de_champ_yes_no)
|
||||
|
||||
procedure.types_de_champ << type_de_champ
|
||||
end
|
||||
|
@ -114,27 +114,26 @@ FactoryBot.define do
|
|||
trait :with_all_champs_mandatory do
|
||||
after(:build) do |procedure, _evaluator|
|
||||
tdcs = []
|
||||
tdcs << create(:type_de_champ, type_champ: 'text', mandatory: true, libelle: 'text')
|
||||
tdcs << create(:type_de_champ, type_champ: 'textarea', mandatory: true, libelle: 'textarea')
|
||||
tdcs << create(:type_de_champ, type_champ: 'date', mandatory: true, libelle: 'date')
|
||||
tdcs << create(:type_de_champ, type_champ: 'datetime', mandatory: true, libelle: 'datetime')
|
||||
tdcs << create(:type_de_champ, type_champ: 'number', mandatory: true, libelle: 'number')
|
||||
tdcs << create(:type_de_champ, type_champ: 'checkbox', mandatory: true, libelle: 'checkbox')
|
||||
tdcs << create(:type_de_champ, type_champ: 'civilite', mandatory: true, libelle: 'civilite')
|
||||
tdcs << create(:type_de_champ, type_champ: 'email', mandatory: true, libelle: 'email')
|
||||
tdcs << create(:type_de_champ, type_champ: 'phone', mandatory: true, libelle: 'phone')
|
||||
tdcs << create(:type_de_champ, type_champ: 'yes_no', mandatory: true, libelle: 'yes_no')
|
||||
tdcs << create(:type_de_champ, :type_drop_down_list, mandatory: true, libelle: 'simple_drop_down_list')
|
||||
tdcs << create(:type_de_champ, :type_drop_down_list, type_champ: 'multiple_drop_down_list', mandatory: true, libelle: 'multiple_drop_down_list')
|
||||
tdcs << create(:type_de_champ, type_champ: 'pays', mandatory: true, libelle: 'pays')
|
||||
tdcs << create(:type_de_champ, type_champ: 'regions', mandatory: true, libelle: 'regions')
|
||||
tdcs << create(:type_de_champ, type_champ: 'departements', mandatory: true, libelle: 'departements')
|
||||
tdcs << create(:type_de_champ, type_champ: 'engagement', mandatory: true, libelle: 'engagement')
|
||||
tdcs << create(:type_de_champ, type_champ: 'header_section', mandatory: true, libelle: 'header_section')
|
||||
tdcs << create(:type_de_champ, type_champ: 'explication', mandatory: true, libelle: 'explication')
|
||||
tdcs << create(:type_de_champ, :type_dossier_link, mandatory: true, libelle: 'dossier_link')
|
||||
tdcs << create(:type_de_champ, type_champ: 'piece_justificative', mandatory: true, libelle: 'piece_justificative')
|
||||
|
||||
tdcs << create(:type_de_champ, mandatory: true, libelle: 'text')
|
||||
tdcs << create(:type_de_champ_textarea, mandatory: true, libelle: 'textarea')
|
||||
tdcs << create(:type_de_champ_date, mandatory: true, libelle: 'date')
|
||||
tdcs << create(:type_de_champ_datetime, mandatory: true, libelle: 'datetime')
|
||||
tdcs << create(:type_de_champ_number, mandatory: true, libelle: 'number')
|
||||
tdcs << create(:type_de_champ_checkbox, mandatory: true, libelle: 'checkbox')
|
||||
tdcs << create(:type_de_champ_civilite, mandatory: true, libelle: 'civilite')
|
||||
tdcs << create(:type_de_champ_email, mandatory: true, libelle: 'email')
|
||||
tdcs << create(:type_de_champ_phone, mandatory: true, libelle: 'phone')
|
||||
tdcs << create(:type_de_champ_yes_no, mandatory: true, libelle: 'yes_no')
|
||||
tdcs << create(:type_de_champ_drop_down_list, mandatory: true, libelle: 'simple_drop_down_list')
|
||||
tdcs << create(:type_de_champ_multiple_drop_down_list, mandatory: true, libelle: 'multiple_drop_down_list')
|
||||
tdcs << create(:type_de_champ_pays, mandatory: true, libelle: 'pays')
|
||||
tdcs << create(:type_de_champ_regions, mandatory: true, libelle: 'regions')
|
||||
tdcs << create(:type_de_champ_departements, mandatory: true, libelle: 'departements')
|
||||
tdcs << create(:type_de_champ_engagement, mandatory: true, libelle: 'engagement')
|
||||
tdcs << create(:type_de_champ_header_section, mandatory: true, libelle: 'header_section')
|
||||
tdcs << create(:type_de_champ_explication, mandatory: true, libelle: 'explication')
|
||||
tdcs << create(:type_de_champ_dossier_link, mandatory: true, libelle: 'dossier_link')
|
||||
tdcs << create(:type_de_champ_piece_justificative, mandatory: true, libelle: 'piece_justificative')
|
||||
procedure.types_de_champ = tdcs
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
FactoryBot.define do
|
||||
factory :type_de_champ do
|
||||
factory :type_de_champ, class: 'TypesDeChamp::TextTypeDeChamp' do
|
||||
private false
|
||||
sequence(:libelle) { |n| "Libelle du champ #{n}" }
|
||||
sequence(:description) { |n| "description du champ #{n}" }
|
||||
|
@ -7,33 +7,74 @@ FactoryBot.define do
|
|||
order_place 1
|
||||
mandatory false
|
||||
|
||||
trait :checkbox do
|
||||
factory :type_de_champ_text, class: 'TypesDeChamp::TextTypeDeChamp' do
|
||||
type_champ 'text'
|
||||
end
|
||||
factory :type_de_champ_textarea, class: 'TypesDeChamp::TextareaTypeDeChamp' do
|
||||
type_champ 'textarea'
|
||||
end
|
||||
factory :type_de_champ_number, class: 'TypesDeChamp::NumberTypeDeChamp' do
|
||||
type_champ 'number'
|
||||
end
|
||||
factory :type_de_champ_checkbox, class: 'TypesDeChamp::CheckboxTypeDeChamp' do
|
||||
type_champ 'checkbox'
|
||||
end
|
||||
|
||||
trait :header_section do
|
||||
type_champ 'header_section'
|
||||
factory :type_de_champ_civilite, class: 'TypesDeChamp::CiviliteTypeDeChamp' do
|
||||
type_champ 'civilite'
|
||||
end
|
||||
|
||||
trait :explication do
|
||||
type_champ 'explication'
|
||||
factory :type_de_champ_email, class: 'TypesDeChamp::EmailTypeDeChamp' do
|
||||
type_champ 'email'
|
||||
end
|
||||
|
||||
trait :type_dossier_link do
|
||||
libelle 'Référence autre dossier'
|
||||
type_champ 'dossier_link'
|
||||
factory :type_de_champ_phone, class: 'TypesDeChamp::PhoneTypeDeChamp' do
|
||||
type_champ 'phone'
|
||||
end
|
||||
|
||||
trait :type_yes_no do
|
||||
factory :type_de_champ_address, class: 'TypesDeChamp::AddressTypeDeChamp' do
|
||||
type_champ 'address'
|
||||
end
|
||||
factory :type_de_champ_yes_no, class: 'TypesDeChamp::YesNoTypeDeChamp' do
|
||||
libelle 'Yes/no'
|
||||
type_champ 'yes_no'
|
||||
end
|
||||
|
||||
trait :type_drop_down_list do
|
||||
factory :type_de_champ_date, class: 'TypesDeChamp::DateTypeDeChamp' do
|
||||
type_champ 'date'
|
||||
end
|
||||
factory :type_de_champ_datetime, class: 'TypesDeChamp::DatetimeTypeDeChamp' do
|
||||
type_champ 'datetime'
|
||||
end
|
||||
factory :type_de_champ_drop_down_list, class: 'TypesDeChamp::DropDownListTypeDeChamp' do
|
||||
libelle 'Menu déroulant'
|
||||
type_champ 'drop_down_list'
|
||||
drop_down_list { create(:drop_down_list) }
|
||||
end
|
||||
factory :type_de_champ_multiple_drop_down_list, class: 'TypesDeChamp::MultipleDropDownListTypeDeChamp' do
|
||||
type_champ 'multiple_drop_down_list'
|
||||
drop_down_list { create(:drop_down_list) }
|
||||
end
|
||||
factory :type_de_champ_pays, class: 'TypesDeChamp::PaysTypeDeChamp' do
|
||||
type_champ 'pays'
|
||||
end
|
||||
factory :type_de_champ_regions, class: 'TypesDeChamp::RegionTypeDeChamp' do
|
||||
type_champ 'regions'
|
||||
end
|
||||
factory :type_de_champ_departements, class: 'TypesDeChamp::DepartementTypeDeChamp' do
|
||||
type_champ 'departements'
|
||||
end
|
||||
factory :type_de_champ_engagement, class: 'TypesDeChamp::EngagementTypeDeChamp' do
|
||||
type_champ 'engagement'
|
||||
end
|
||||
factory :type_de_champ_header_section, class: 'TypesDeChamp::HeaderSectionTypeDeChamp' do
|
||||
type_champ 'header_section'
|
||||
end
|
||||
factory :type_de_champ_explication, class: 'TypesDeChamp::ExplicationTypeDeChamp' do
|
||||
type_champ 'explication'
|
||||
end
|
||||
factory :type_de_champ_dossier_link, class: 'TypesDeChamp::DossierLinkTypeDeChamp' do
|
||||
libelle 'Référence autre dossier'
|
||||
type_champ 'dossier_link'
|
||||
end
|
||||
factory :type_de_champ_piece_justificative, class: 'TypesDeChamp::PieceJustificativeTypeDeChamp' do
|
||||
type_champ 'piece_justificative'
|
||||
end
|
||||
|
||||
trait :private do
|
||||
private true
|
||||
|
|
|
@ -84,7 +84,7 @@ feature 'The user' do
|
|||
end
|
||||
|
||||
let(:simple_procedure) do
|
||||
tdcs = [create(:type_de_champ, type_champ: 'text', mandatory: true, libelle: 'text')]
|
||||
tdcs = [create(:type_de_champ, mandatory: true, libelle: 'text')]
|
||||
create(:procedure, :published, :for_individual, types_de_champ: tdcs)
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
|
||||
describe '2018_03_06_clean_html_textareas#clean' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
let(:type_champ) { create(:type_de_champ, procedure: procedure, type_champ: :textarea) }
|
||||
let(:type_champ) { create(:type_de_champ_textarea, procedure: procedure) }
|
||||
let(:champ) { type_champ.champ.create(value: "<p>Gnahar<br>greu bouahaha</p>") }
|
||||
let(:champ_date) { Time.local(1995) }
|
||||
let(:rake_date) { Time.local(2018) }
|
||||
|
|
|
@ -33,7 +33,7 @@ shared_examples 'champ_spec' do
|
|||
end
|
||||
|
||||
context "when type_champ=date" do
|
||||
let(:type_de_champ) { create(:type_de_champ, type_champ: "date") }
|
||||
let(:type_de_champ) { create(:type_de_champ_date) }
|
||||
let(:champ) { type_de_champ.champ.create }
|
||||
|
||||
it "should convert %d/%m/%Y format to ISO" do
|
||||
|
|
|
@ -23,7 +23,7 @@ describe Champ do
|
|||
end
|
||||
|
||||
describe '#format_datetime' do
|
||||
let(:type_de_champ) { build(:type_de_champ, type_champ: 'datetime') }
|
||||
let(:type_de_champ) { build(:type_de_champ_datetime) }
|
||||
let(:champ) { type_de_champ.champ.build(value: value) }
|
||||
|
||||
before { champ.save }
|
||||
|
@ -42,7 +42,7 @@ describe Champ do
|
|||
end
|
||||
|
||||
describe '#multiple_select_to_string' do
|
||||
let(:type_de_champ) { build(:type_de_champ, type_champ: 'multiple_drop_down_list') }
|
||||
let(:type_de_champ) { build(:type_de_champ_multiple_drop_down_list) }
|
||||
let(:champ) { type_de_champ.champ.build(value: value) }
|
||||
|
||||
before { champ.save }
|
||||
|
@ -80,27 +80,26 @@ describe Champ do
|
|||
end
|
||||
|
||||
describe 'for_export' do
|
||||
let(:type_de_champ) { create(:type_de_champ, type_champ: type_champ) }
|
||||
let(:type_de_champ) { create(:type_de_champ) }
|
||||
let(:champ) { type_de_champ.champ.build(value: value) }
|
||||
|
||||
before { champ.save }
|
||||
|
||||
context 'when type_de_champ is text' do
|
||||
let(:type_champ) { 'text' }
|
||||
let(:value) { '123' }
|
||||
|
||||
it { expect(champ.for_export).to eq('123') }
|
||||
end
|
||||
|
||||
context 'when type_de_champ is textarea' do
|
||||
let(:type_champ) { 'textarea' }
|
||||
let(:type_de_champ) { create(:type_de_champ_textarea) }
|
||||
let(:value) { '<b>gras<b>' }
|
||||
|
||||
it { expect(champ.for_export).to eq('gras') }
|
||||
end
|
||||
|
||||
context 'when type_de_champ is yes_no' do
|
||||
let(:type_champ) { 'yes_no' }
|
||||
let(:type_de_champ) { create(:type_de_champ_yes_no) }
|
||||
|
||||
context 'if yes' do
|
||||
let(:value) { 'true' }
|
||||
|
@ -122,11 +121,9 @@ describe Champ do
|
|||
end
|
||||
|
||||
context 'when type_de_champ is multiple_drop_down_list' do
|
||||
let(:type_champ) { 'multiple_drop_down_list' }
|
||||
let(:type_de_champ) { create(:type_de_champ_multiple_drop_down_list) }
|
||||
let(:value) { '["Crétinier", "Mousserie"]' }
|
||||
|
||||
before { type_de_champ.drop_down_list = create(:drop_down_list) }
|
||||
|
||||
it { expect(champ.for_export).to eq('Crétinier, Mousserie') }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -161,8 +161,8 @@ describe TagsSubstitutionConcern, type: :model do
|
|||
context 'when the procedure has 2 types de champ date and datetime' do
|
||||
let(:types_de_champ) do
|
||||
[
|
||||
create(:type_de_champ, libelle: 'date', type_champ: 'date'),
|
||||
create(:type_de_champ, libelle: 'datetime', type_champ: 'datetime')
|
||||
create(:type_de_champ_date, libelle: 'date'),
|
||||
create(:type_de_champ_datetime, libelle: 'datetime')
|
||||
]
|
||||
end
|
||||
|
||||
|
|
|
@ -47,14 +47,14 @@ describe DropDownList do
|
|||
end
|
||||
|
||||
context 'when multiple' do
|
||||
let(:type_de_champ) { build(:type_de_champ, type_champ: 'multiple_drop_down_list') }
|
||||
let(:type_de_champ) { build(:type_de_champ_multiple_drop_down_list) }
|
||||
let(:champ) { type_de_champ.champ.build(value: '["1","2"]').decorate }
|
||||
|
||||
it { expect(dropdownlist.selected_options(champ)).to match(['1', '2']) }
|
||||
end
|
||||
|
||||
context 'when simple' do
|
||||
let(:type_de_champ) { build(:type_de_champ, type_champ: 'drop_down_list') }
|
||||
let(:type_de_champ) { build(:type_de_champ_drop_down_list) }
|
||||
let(:champ) { type_de_champ.champ.build(value: '1').decorate }
|
||||
|
||||
it { expect(dropdownlist.selected_options(champ)).to match(['1']) }
|
||||
|
|
|
@ -155,10 +155,10 @@ describe Procedure do
|
|||
let(:procedure) { create(:procedure, archived_at: archived_at, published_at: published_at, received_mail: received_mail) }
|
||||
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 0) }
|
||||
let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure, order_place: 1) }
|
||||
let!(:type_de_champ_2) { create(:type_de_champ, :type_drop_down_list, procedure: procedure, order_place: 2) }
|
||||
let!(:type_de_champ_2) { create(:type_de_champ_drop_down_list, procedure: procedure, order_place: 2) }
|
||||
let!(:type_de_champ_private_0) { create(:type_de_champ, :private, procedure: procedure, order_place: 0) }
|
||||
let!(:type_de_champ_private_1) { create(:type_de_champ, :private, procedure: procedure, order_place: 1) }
|
||||
let!(:type_de_champ_private_2) { create(:type_de_champ, :private, :type_drop_down_list, procedure: procedure, order_place: 2) }
|
||||
let!(:type_de_champ_private_2) { create(:type_de_champ_drop_down_list, :private, procedure: procedure, order_place: 2) }
|
||||
let!(:piece_justificative_0) { create(:type_de_piece_justificative, procedure: procedure, order_place: 0) }
|
||||
let!(:piece_justificative_1) { create(:type_de_piece_justificative, procedure: procedure, order_place: 1) }
|
||||
let(:received_mail){ create(:received_mail) }
|
||||
|
|
|
@ -15,6 +15,16 @@ shared_examples 'type_de_champ_spec' do
|
|||
it { is_expected.to allow_value('datetime').for(:type_champ) }
|
||||
it { is_expected.to allow_value('number').for(:type_champ) }
|
||||
it { is_expected.to allow_value('checkbox').for(:type_champ) }
|
||||
|
||||
it do
|
||||
TypeDeChamp.type_champs.each do |(type_champ, _)|
|
||||
type_de_champ = create(:"type_de_champ_#{type_champ}")
|
||||
champ = type_de_champ.champ.create
|
||||
|
||||
expect(type_de_champ.class.name).to match(/^TypesDeChamp::/)
|
||||
expect(champ.class.name).to match(/^Champs::/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'order_place' do
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||
describe ChampsService do
|
||||
let(:type_de_champ) { create(:type_de_champ) }
|
||||
let(:type_de_champ_mandatory) { create(:type_de_champ, libelle: 'mandatory', mandatory: true) }
|
||||
let(:type_de_champ_datetime) { create(:type_de_champ, type_champ: :datetime) }
|
||||
let(:type_de_champ_datetime) { create(:type_de_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 }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/champs/date.html.haml', type: :view do
|
||||
let(:type_champ) { create(:type_de_champ, type_champ: :date) }
|
||||
let(:type_champ) { create(:type_de_champ_date) }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/date.html.haml', champ: champ
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/champs/dossier_link.html.haml', type: :view do
|
||||
let(:type_champ) { create(:type_de_champ, type_champ: :dossier_link) }
|
||||
let(:type_champ) { create(:type_de_champ_dossier_link) }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/dossier_link.html.haml', champ: champ
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/champs/engagement.html.haml', type: :view do
|
||||
let(:type_champ) { create(:type_de_champ, type_champ: :engagement) }
|
||||
let(:type_champ) { create(:type_de_champ_engagement) }
|
||||
|
||||
subject { render 'users/description/champs/engagement.html.haml', champ: champ }
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
describe 'users/description/champs/render_list_champs.html.haml', type: :view do
|
||||
let(:type_champ) { create(:type_de_champ, :checkbox) }
|
||||
let(:type_champ) { create(:type_de_champ_checkbox) }
|
||||
|
||||
context "with any champ" do
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: nil) }
|
||||
|
@ -40,7 +40,7 @@ describe 'users/description/champs/render_list_champs.html.haml', type: :view do
|
|||
end
|
||||
|
||||
context 'with a dossier_link' do
|
||||
let(:type_champ) { create(:type_de_champ, type_champ: :dossier_link) }
|
||||
let(:type_champ) { create(:type_de_champ_dossier_link) }
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: nil) }
|
||||
|
||||
before do
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/champs/yes_no.html.haml', type: :view do
|
||||
let(:type_champ) { create(:type_de_champ, type_champ: :yes_no) }
|
||||
let(:type_champ) { create(:type_de_champ_yes_no) }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/yes_no.html.haml', champ: champ
|
||||
|
|
Loading…
Reference in a new issue