Merge pull request #1430 from tchak/type-de-champ-private
Remove TypeDeChampPublic/TypeDeChampPrivate STI
This commit is contained in:
commit
551014b4ea
41 changed files with 179 additions and 187 deletions
|
@ -19,7 +19,7 @@ class RootController < ApplicationController
|
||||||
description = 'a not so long description'
|
description = 'a not so long description'
|
||||||
|
|
||||||
all_champs = TypeDeChamp.type_champs
|
all_champs = TypeDeChamp.type_champs
|
||||||
.map { |name, _| TypeDeChamp.new(type_champ: name, libelle: name, description: description, mandatory: true) }
|
.map { |name, _| TypeDeChamp.new(type_champ: name, private: false, libelle: name, description: description, mandatory: true) }
|
||||||
.map.with_index { |type_de_champ, i| type_de_champ.champ.build(id: i) }
|
.map.with_index { |type_de_champ, i| type_de_champ.champ.build(id: i) }
|
||||||
|
|
||||||
all_champs
|
all_champs
|
||||||
|
|
|
@ -23,7 +23,7 @@ class AdminTypesDeChampFacades
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_type_de_champ
|
def new_type_de_champ
|
||||||
@private ? TypeDeChampPrivate.new.decorate : TypeDeChampPublic.new.decorate
|
TypeDeChamp.new(private: @private).decorate
|
||||||
end
|
end
|
||||||
|
|
||||||
def fields_for_var
|
def fields_for_var
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class Procedure < ActiveRecord::Base
|
class Procedure < ActiveRecord::Base
|
||||||
has_many :types_de_piece_justificative, -> { order "order_place ASC" }, dependent: :destroy
|
has_many :types_de_piece_justificative, -> { order "order_place ASC" }, dependent: :destroy
|
||||||
has_many :types_de_champ, class_name: 'TypeDeChampPublic', dependent: :destroy
|
has_many :types_de_champ, -> { public_only }, dependent: :destroy
|
||||||
has_many :types_de_champ_private, dependent: :destroy
|
has_many :types_de_champ_private, -> { private_only }, class_name: 'TypeDeChamp', dependent: :destroy
|
||||||
has_many :dossiers
|
has_many :dossiers
|
||||||
|
|
||||||
has_one :procedure_path, dependent: :destroy
|
has_one :procedure_path, dependent: :destroy
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
class TypeDeChamp < ActiveRecord::Base
|
class TypeDeChamp < ActiveRecord::Base
|
||||||
|
self.inheritance_column = :_type_disabled
|
||||||
|
|
||||||
enum type_champs: {
|
enum type_champs: {
|
||||||
text: 'text',
|
text: 'text',
|
||||||
textarea: 'textarea',
|
textarea: 'textarea',
|
||||||
|
@ -24,6 +26,9 @@ class TypeDeChamp < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :procedure
|
belongs_to :procedure
|
||||||
|
|
||||||
|
scope :public_only, -> { where.not(type: 'TypeDeChampPrivate').or(where(private: [false, nil])) }
|
||||||
|
scope :private_only, -> { where(type: 'TypeDeChampPrivate').or(where(private: true)) }
|
||||||
|
|
||||||
has_many :champ, inverse_of: :type_de_champ, dependent: :destroy do
|
has_many :champ, inverse_of: :type_de_champ, dependent: :destroy do
|
||||||
def build(params = {})
|
def build(params = {})
|
||||||
super(params.merge(proxy_association.owner.params_for_champ))
|
super(params.merge(proxy_association.owner.params_for_champ))
|
||||||
|
@ -65,7 +70,7 @@ class TypeDeChamp < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def private?
|
def private?
|
||||||
type == 'TypeDeChampPrivate'
|
super || type == 'TypeDeChampPrivate'
|
||||||
end
|
end
|
||||||
|
|
||||||
def public?
|
def public?
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
class TypeDeChampPrivate < TypeDeChamp
|
|
||||||
end
|
|
|
@ -1,2 +0,0 @@
|
||||||
class TypeDeChampPublic < TypeDeChamp
|
|
||||||
end
|
|
|
@ -13,17 +13,17 @@ class TypesDeChampService
|
||||||
:type_champ,
|
:type_champ,
|
||||||
:id,
|
:id,
|
||||||
:mandatory,
|
:mandatory,
|
||||||
:type,
|
|
||||||
drop_down_list_attributes: [:value, :id]
|
drop_down_list_attributes: [:value, :id]
|
||||||
])
|
])
|
||||||
|
|
||||||
parameters[attributes].each do |param_first, param_second|
|
parameters[attributes].each do |index, param|
|
||||||
if param_second[:libelle].empty?
|
param[:private] = private
|
||||||
parameters[attributes].delete(param_first.to_s)
|
if param[:libelle].empty?
|
||||||
|
parameters[attributes].delete(index.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
if param_second['drop_down_list_attributes'] && param_second['drop_down_list_attributes']['value']
|
if param['drop_down_list_attributes'] && param['drop_down_list_attributes']['value']
|
||||||
param_second['drop_down_list_attributes']['value'] = self.clean_value (param_second['drop_down_list_attributes']['value'])
|
param['drop_down_list_attributes']['value'] = self.clean_value (param['drop_down_list_attributes']['value'])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
description: '',
|
description: '',
|
||||||
order_place: '1',
|
order_place: '1',
|
||||||
id: '',
|
id: '',
|
||||||
mandatory: false,
|
mandatory: false
|
||||||
type: 'TypeDeChampPublic'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +147,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
context 'when procedure and type de champs are not linked' do
|
context 'when procedure and type de champs are not linked' do
|
||||||
let(:type_de_champ) { create(:type_de_champ_public) }
|
let(:type_de_champ) { create(:type_de_champ) }
|
||||||
let(:type_de_champ_id) { type_de_champ.id }
|
let(:type_de_champ_id) { type_de_champ.id }
|
||||||
it { expect(subject.status).to eq(404) }
|
it { expect(subject.status).to eq(404) }
|
||||||
end
|
end
|
||||||
|
@ -163,20 +162,20 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
end
|
end
|
||||||
context 'when procedure have only one type de champ' do
|
context 'when procedure have only one type de champ' do
|
||||||
let(:index) { 1 }
|
let(:index) { 1 }
|
||||||
let!(:type_de_champ) { create(:type_de_champ_public, procedure: procedure) }
|
let!(:type_de_champ) { create(:type_de_champ, procedure: procedure) }
|
||||||
it { expect(subject.status).to eq(400) }
|
it { expect(subject.status).to eq(400) }
|
||||||
end
|
end
|
||||||
context 'when procedure have tow type de champs' do
|
context 'when procedure have tow type de champs' do
|
||||||
context 'when index == 0' do
|
context 'when index == 0' do
|
||||||
let(:index) { 0 }
|
let(:index) { 0 }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_public, procedure: procedure) }
|
let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure) }
|
||||||
let!(:type_de_champ_2) { create(:type_de_champ_public, procedure: procedure) }
|
let!(:type_de_champ_2) { create(:type_de_champ, procedure: procedure) }
|
||||||
it { expect(subject.status).to eq(400) }
|
it { expect(subject.status).to eq(400) }
|
||||||
end
|
end
|
||||||
context 'when index > 0' do
|
context 'when index > 0' do
|
||||||
let(:index) { 1 }
|
let(:index) { 1 }
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_public, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 0) }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_public, procedure: procedure, order_place: 1) }
|
let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure, order_place: 1) }
|
||||||
|
|
||||||
it { expect(subject.status).to eq(200) }
|
it { expect(subject.status).to eq(200) }
|
||||||
it { expect(subject).to render_template('show') }
|
it { expect(subject).to render_template('show') }
|
||||||
|
@ -201,12 +200,12 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
it { expect(subject.status).to eq(400) }
|
it { expect(subject.status).to eq(400) }
|
||||||
end
|
end
|
||||||
context 'when procedure have only one type de champ' do
|
context 'when procedure have only one type de champ' do
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_public, procedure: procedure) }
|
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure) }
|
||||||
it { expect(subject.status).to eq(400) }
|
it { expect(subject.status).to eq(400) }
|
||||||
end
|
end
|
||||||
context 'when procedure have 2 type de champ' do
|
context 'when procedure have 2 type de champ' do
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_public, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 0) }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_public, procedure: procedure, order_place: 1) }
|
let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure, order_place: 1) }
|
||||||
context 'when index represent last type_de_champ' do
|
context 'when index represent last type_de_champ' do
|
||||||
let(:index) { 1 }
|
let(:index) { 1 }
|
||||||
it { expect(subject.status).to eq(400) }
|
it { expect(subject.status).to eq(400) }
|
||||||
|
|
|
@ -49,8 +49,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
|
||||||
description: description,
|
description: description,
|
||||||
order_place: order_place,
|
order_place: order_place,
|
||||||
id: types_de_champ_id,
|
id: types_de_champ_id,
|
||||||
mandatory: mandatory,
|
mandatory: mandatory
|
||||||
type: 'TypeDeChampPrivate'
|
|
||||||
},
|
},
|
||||||
'1' => {
|
'1' => {
|
||||||
libelle: '',
|
libelle: '',
|
||||||
|
@ -58,8 +57,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
|
||||||
description: '',
|
description: '',
|
||||||
order_place: '1',
|
order_place: '1',
|
||||||
id: '',
|
id: '',
|
||||||
mandatory: false,
|
mandatory: false
|
||||||
type: 'TypeDeChampPrivate'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,7 +129,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
context 'when procedure and type de champs are not linked' do
|
context 'when procedure and type de champs are not linked' do
|
||||||
let(:type_de_champ) { create(:type_de_champ_public) }
|
let(:type_de_champ) { create(:type_de_champ) }
|
||||||
let(:type_de_champ_id) { type_de_champ.id }
|
let(:type_de_champ_id) { type_de_champ.id }
|
||||||
it { expect(subject.status).to eq(404) }
|
it { expect(subject.status).to eq(404) }
|
||||||
end
|
end
|
||||||
|
@ -146,20 +144,20 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
|
||||||
end
|
end
|
||||||
context 'when procedure have only one type de champ' do
|
context 'when procedure have only one type de champ' do
|
||||||
let(:index) { 1 }
|
let(:index) { 1 }
|
||||||
let!(:type_de_champ) { create(:type_de_champ_private, procedure: procedure) }
|
let!(:type_de_champ) { create(:type_de_champ, :private, procedure: procedure) }
|
||||||
it { expect(subject.status).to eq(400) }
|
it { expect(subject.status).to eq(400) }
|
||||||
end
|
end
|
||||||
context 'when procedure have tow type de champs' do
|
context 'when procedure have tow type de champs' do
|
||||||
context 'when index == 0' do
|
context 'when index == 0' do
|
||||||
let(:index) { 0 }
|
let(:index) { 0 }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_private, procedure: procedure) }
|
let!(:type_de_champ_1) { create(:type_de_champ, :private, procedure: procedure) }
|
||||||
let!(:type_de_champ_2) { create(:type_de_champ_private, procedure: procedure) }
|
let!(:type_de_champ_2) { create(:type_de_champ, :private, procedure: procedure) }
|
||||||
it { expect(subject.status).to eq(400) }
|
it { expect(subject.status).to eq(400) }
|
||||||
end
|
end
|
||||||
context 'when index > 0' do
|
context 'when index > 0' do
|
||||||
let(:index) { 1 }
|
let(:index) { 1 }
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_private, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, :private, procedure: procedure, order_place: 0) }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_private, procedure: procedure, order_place: 1) }
|
let!(:type_de_champ_1) { create(:type_de_champ, :private, procedure: procedure, order_place: 1) }
|
||||||
|
|
||||||
it { expect(subject.status).to eq(200) }
|
it { expect(subject.status).to eq(200) }
|
||||||
it { expect(subject).to render_template('show') }
|
it { expect(subject).to render_template('show') }
|
||||||
|
@ -184,12 +182,12 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
|
||||||
it { expect(subject.status).to eq(400) }
|
it { expect(subject.status).to eq(400) }
|
||||||
end
|
end
|
||||||
context 'when procedure have only one type de champ' do
|
context 'when procedure have only one type de champ' do
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_private, procedure: procedure) }
|
let!(:type_de_champ_0) { create(:type_de_champ, :private, procedure: procedure) }
|
||||||
it { expect(subject.status).to eq(400) }
|
it { expect(subject.status).to eq(400) }
|
||||||
end
|
end
|
||||||
context 'when procedure have 2 type de champ' do
|
context 'when procedure have 2 type de champ' do
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_private, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, :private, procedure: procedure, order_place: 0) }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_private, procedure: procedure, order_place: 1) }
|
let!(:type_de_champ_1) { create(:type_de_champ, :private, procedure: procedure, order_place: 1) }
|
||||||
context 'when index represent last type_de_champ' do
|
context 'when index represent last type_de_champ' do
|
||||||
let(:index) { 1 }
|
let(:index) { 1 }
|
||||||
it { expect(subject.status).to eq(400) }
|
it { expect(subject.status).to eq(400) }
|
||||||
|
|
|
@ -355,11 +355,11 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
|
|
||||||
describe "#update_annotations" do
|
describe "#update_annotations" do
|
||||||
let(:champ_multiple_drop_down_list) 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, :private, type_champ: 'multiple_drop_down_list', libelle: 'libelle').champ.create
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:champ_datetime) do
|
let(:champ_datetime) do
|
||||||
create(:type_de_champ_private, type_champ: 'datetime', libelle: 'libelle').champ.create
|
create(:type_de_champ, :private, type_champ: 'datetime', libelle: 'libelle').champ.create
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:dossier) do
|
let(:dossier) do
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe ChampDecorator do
|
describe ChampDecorator do
|
||||||
let(:champ) { create :champ, type_de_champ: (create :type_de_champ_public, type_champ: type_champ) }
|
let(:type_de_champ) { create(:type_de_champ, type_champ: type_champ) }
|
||||||
|
let(:champ) { type_de_champ.champ.create }
|
||||||
let(:decorator) { champ.decorate }
|
let(:decorator) { champ.decorate }
|
||||||
|
|
||||||
describe 'value' do
|
describe 'value' do
|
||||||
|
|
|
@ -4,9 +4,9 @@ describe TypeDeChampDecorator do
|
||||||
let(:procedure) { create(:procedure) }
|
let(:procedure) { create(:procedure) }
|
||||||
let(:url) { 'http://localhost' }
|
let(:url) { 'http://localhost' }
|
||||||
let(:params) { { url: url, index: index } }
|
let(:params) { { url: url, index: index } }
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_public, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 0) }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_public, procedure: procedure, order_place: 1) }
|
let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure, order_place: 1) }
|
||||||
let!(:type_de_champ_2) { create(:type_de_champ_public, procedure: procedure, order_place: 2) }
|
let!(:type_de_champ_2) { create(:type_de_champ, procedure: procedure, order_place: 2) }
|
||||||
|
|
||||||
describe '#button_up' do
|
describe '#button_up' do
|
||||||
describe 'with first piece justificative' do
|
describe 'with first piece justificative' do
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :champ do
|
factory :champ do
|
||||||
type_de_champ { FactoryBot.create(:type_de_champ_public) }
|
type_de_champ { FactoryBot.create(:type_de_champ) }
|
||||||
|
|
||||||
trait :checkbox do
|
trait :checkbox do
|
||||||
type_de_champ { FactoryBot.create(:type_de_champ_public, :checkbox) }
|
type_de_champ { FactoryBot.create(:type_de_champ, :checkbox) }
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :header_section do
|
trait :header_section do
|
||||||
type_de_champ { FactoryBot.create(:type_de_champ_public, :header_section) }
|
type_de_champ { FactoryBot.create(:type_de_champ, :header_section) }
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :explication do
|
trait :explication do
|
||||||
type_de_champ { FactoryBot.create(:type_de_champ_public, :explication) }
|
type_de_champ { FactoryBot.create(:type_de_champ, :explication) }
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :dossier_link do
|
trait :dossier_link do
|
||||||
type_de_champ { FactoryBot.create(:type_de_champ_public, :type_dossier_link) }
|
type_de_champ { FactoryBot.create(:type_de_champ, :type_dossier_link) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,7 +36,7 @@ FactoryBot.define do
|
||||||
|
|
||||||
after(:build) do |procedure, evaluator|
|
after(:build) do |procedure, evaluator|
|
||||||
evaluator.types_de_champ_count.times do
|
evaluator.types_de_champ_count.times do
|
||||||
type_de_champ = create(:type_de_champ_public)
|
type_de_champ = create(:type_de_champ)
|
||||||
|
|
||||||
procedure.types_de_champ << type_de_champ
|
procedure.types_de_champ << type_de_champ
|
||||||
end
|
end
|
||||||
|
@ -50,7 +50,7 @@ FactoryBot.define do
|
||||||
|
|
||||||
after(:build) do |procedure, evaluator|
|
after(:build) do |procedure, evaluator|
|
||||||
evaluator.types_de_champ_private_count.times do
|
evaluator.types_de_champ_private_count.times do
|
||||||
type_de_champ = create(:type_de_champ_private)
|
type_de_champ = create(:type_de_champ, :private)
|
||||||
|
|
||||||
procedure.types_de_champ_private << type_de_champ
|
procedure.types_de_champ_private << type_de_champ
|
||||||
end
|
end
|
||||||
|
@ -59,7 +59,7 @@ FactoryBot.define do
|
||||||
|
|
||||||
trait :with_type_de_champ_mandatory do
|
trait :with_type_de_champ_mandatory do
|
||||||
after(:build) do |procedure, _evaluator|
|
after(:build) do |procedure, _evaluator|
|
||||||
type_de_champ = create(:type_de_champ_public, mandatory: true)
|
type_de_champ = create(:type_de_champ, mandatory: true)
|
||||||
|
|
||||||
procedure.types_de_champ << type_de_champ
|
procedure.types_de_champ << type_de_champ
|
||||||
end
|
end
|
||||||
|
@ -67,7 +67,7 @@ FactoryBot.define do
|
||||||
|
|
||||||
trait :with_datetime do
|
trait :with_datetime do
|
||||||
after(:build) do |procedure, _evaluator|
|
after(:build) do |procedure, _evaluator|
|
||||||
type_de_champ = create(:type_de_champ_public, mandatory: true, type_champ: :datetime)
|
type_de_champ = create(:type_de_champ, mandatory: true, type_champ: :datetime)
|
||||||
|
|
||||||
procedure.types_de_champ << type_de_champ
|
procedure.types_de_champ << type_de_champ
|
||||||
end
|
end
|
||||||
|
@ -75,7 +75,7 @@ FactoryBot.define do
|
||||||
|
|
||||||
trait :with_dossier_link do
|
trait :with_dossier_link do
|
||||||
after(:build) do |procedure, _evaluator|
|
after(:build) do |procedure, _evaluator|
|
||||||
type_de_champ = create(:type_de_champ_public, :type_dossier_link)
|
type_de_champ = create(:type_de_champ, :type_dossier_link)
|
||||||
|
|
||||||
procedure.types_de_champ << type_de_champ
|
procedure.types_de_champ << type_de_champ
|
||||||
end
|
end
|
||||||
|
@ -83,7 +83,7 @@ FactoryBot.define do
|
||||||
|
|
||||||
trait :with_yes_no do
|
trait :with_yes_no do
|
||||||
after(:build) do |procedure, _evaluator|
|
after(:build) do |procedure, _evaluator|
|
||||||
type_de_champ = create(:type_de_champ_public, :type_yes_no)
|
type_de_champ = create(:type_de_champ, :type_yes_no)
|
||||||
|
|
||||||
procedure.types_de_champ << type_de_champ
|
procedure.types_de_champ << type_de_champ
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :type_de_champ_public do
|
factory :type_de_champ do
|
||||||
|
private false
|
||||||
sequence(:libelle) { |n| "Libelle du champ #{n}" }
|
sequence(:libelle) { |n| "Libelle du champ #{n}" }
|
||||||
sequence(:description) { |n| "description du champ #{n}" }
|
sequence(:description) { |n| "description du champ #{n}" }
|
||||||
type_champ 'text'
|
type_champ 'text'
|
||||||
|
@ -33,5 +34,11 @@ FactoryBot.define do
|
||||||
type_champ 'drop_down_list'
|
type_champ 'drop_down_list'
|
||||||
drop_down_list { create(:drop_down_list) }
|
drop_down_list { create(:drop_down_list) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
trait :private do
|
||||||
|
private true
|
||||||
|
sequence(:libelle) { |n| "Libelle champ privé #{n}" }
|
||||||
|
sequence(:description) { |n| "description du champ privé #{n}" }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,15 +0,0 @@
|
||||||
FactoryBot.define do
|
|
||||||
factory :type_de_champ_private do
|
|
||||||
sequence(:libelle) { |n| "Libelle champ privé #{n}" }
|
|
||||||
sequence(:description) { |n| "description du champ privé #{n}" }
|
|
||||||
type_champ 'text'
|
|
||||||
order_place 1
|
|
||||||
mandatory false
|
|
||||||
|
|
||||||
trait :type_drop_down_list do
|
|
||||||
libelle 'Menu déroulant'
|
|
||||||
type_champ 'drop_down_list'
|
|
||||||
drop_down_list { create(:drop_down_list) }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -8,10 +8,10 @@ feature 'move down button type de champs', js: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:procedure) { create(:procedure, administrateur: administrateur) }
|
let(:procedure) { create(:procedure, administrateur: administrateur) }
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_private, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, :private, procedure: procedure, order_place: 0) }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_private, procedure: procedure, order_place: 1) }
|
let!(:type_de_champ_1) { create(:type_de_champ, :private, procedure: procedure, order_place: 1) }
|
||||||
let!(:type_de_champ_2) { create(:type_de_champ_private, procedure: procedure, order_place: 2) }
|
let!(:type_de_champ_2) { create(:type_de_champ, :private, procedure: procedure, order_place: 2) }
|
||||||
let!(:type_de_champ_3) { create(:type_de_champ_private, procedure: procedure, order_place: 3) }
|
let!(:type_de_champ_3) { create(:type_de_champ, :private, procedure: procedure, order_place: 3) }
|
||||||
|
|
||||||
context 'when clicking on move down for type de champ 1' do
|
context 'when clicking on move down for type de champ 1' do
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -8,10 +8,10 @@ feature 'move down button type de champs', js: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:procedure) { create(:procedure, administrateur: administrateur) }
|
let(:procedure) { create(:procedure, administrateur: administrateur) }
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_public, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 0) }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_public, procedure: procedure, order_place: 1) }
|
let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure, order_place: 1) }
|
||||||
let!(:type_de_champ_2) { create(:type_de_champ_public, procedure: procedure, order_place: 2) }
|
let!(:type_de_champ_2) { create(:type_de_champ, procedure: procedure, order_place: 2) }
|
||||||
let!(:type_de_champ_3) { create(:type_de_champ_public, procedure: procedure, order_place: 3) }
|
let!(:type_de_champ_3) { create(:type_de_champ, procedure: procedure, order_place: 3) }
|
||||||
|
|
||||||
context 'when clicking on move down for type de champ 1' do
|
context 'when clicking on move down for type de champ 1' do
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -8,10 +8,10 @@ feature 'move up button type de champs', js: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:procedure) { create(:procedure, administrateur: administrateur) }
|
let(:procedure) { create(:procedure, administrateur: administrateur) }
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_private, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, :private, procedure: procedure, order_place: 0) }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_private, procedure: procedure, order_place: 1) }
|
let!(:type_de_champ_1) { create(:type_de_champ, :private, procedure: procedure, order_place: 1) }
|
||||||
let!(:type_de_champ_2) { create(:type_de_champ_private, procedure: procedure, order_place: 2) }
|
let!(:type_de_champ_2) { create(:type_de_champ, :private, procedure: procedure, order_place: 2) }
|
||||||
let!(:type_de_champ_3) { create(:type_de_champ_private, procedure: procedure, order_place: 3) }
|
let!(:type_de_champ_3) { create(:type_de_champ, :private, procedure: procedure, order_place: 3) }
|
||||||
|
|
||||||
context 'when clicking on move down for type de champ 1' do
|
context 'when clicking on move down for type de champ 1' do
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -8,10 +8,10 @@ feature 'move up button type de champs', js: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:procedure) { create(:procedure, administrateur: administrateur) }
|
let(:procedure) { create(:procedure, administrateur: administrateur) }
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_public, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 0) }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_public, procedure: procedure, order_place: 1) }
|
let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure, order_place: 1) }
|
||||||
let!(:type_de_champ_2) { create(:type_de_champ_public, procedure: procedure, order_place: 2) }
|
let!(:type_de_champ_2) { create(:type_de_champ, procedure: procedure, order_place: 2) }
|
||||||
let!(:type_de_champ_3) { create(:type_de_champ_public, procedure: procedure, order_place: 3) }
|
let!(:type_de_champ_3) { create(:type_de_champ, procedure: procedure, order_place: 3) }
|
||||||
|
|
||||||
context 'when clicking on move down for type de champ 1' do
|
context 'when clicking on move down for type de champ 1' do
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -6,7 +6,7 @@ feature 'users: flux de commentaires' do
|
||||||
let(:dossier_id) { dossier.id }
|
let(:dossier_id) { dossier.id }
|
||||||
|
|
||||||
let(:champ1) { dossier.champs.first }
|
let(:champ1) { dossier.champs.first }
|
||||||
let(:champ2) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ_public, libelle: "subtitle")) }
|
let(:champ2) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ, libelle: "subtitle")) }
|
||||||
|
|
||||||
let!(:commentaire1) { create(:commentaire, dossier: dossier, champ: champ1) }
|
let!(:commentaire1) { create(:commentaire, dossier: dossier, champ: champ1) }
|
||||||
let!(:commentaire2) { create(:commentaire, dossier: dossier) }
|
let!(:commentaire2) { create(:commentaire, dossier: dossier) }
|
||||||
|
|
|
@ -4,7 +4,7 @@ RSpec.describe FindDubiousProceduresJob, type: :job do
|
||||||
describe 'perform' do
|
describe 'perform' do
|
||||||
let(:mailer_double) { double('mailer', deliver_now: true) }
|
let(:mailer_double) { double('mailer', deliver_now: true) }
|
||||||
let(:procedure) { create(:procedure) }
|
let(:procedure) { create(:procedure) }
|
||||||
let(:allowed_tdc) { create(:type_de_champ_public, libelle: 'fournir') }
|
let(:allowed_tdc) { create(:type_de_champ, libelle: 'fournir') }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(AdministrationMailer).to receive(:dubious_procedures)
|
allow(AdministrationMailer).to receive(:dubious_procedures)
|
||||||
|
@ -17,8 +17,8 @@ RSpec.describe FindDubiousProceduresJob, type: :job do
|
||||||
context 'with suspicious champs' do
|
context 'with suspicious champs' do
|
||||||
let(:forbidden_tdcs) do
|
let(:forbidden_tdcs) do
|
||||||
[
|
[
|
||||||
create(:type_de_champ_public, libelle: 'num de securite sociale, stp'),
|
create(:type_de_champ, libelle: 'num de securite sociale, stp'),
|
||||||
create(:type_de_champ_public, libelle: "t'aurais une carte bancaire ?")
|
create(:type_de_champ, libelle: "t'aurais une carte bancaire ?")
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -149,8 +149,8 @@ describe AttestationTemplate, type: :model do
|
||||||
context 'when the procedure has a type de champ named libelleA et libelleB' do
|
context 'when the procedure has a type de champ named libelleA et libelleB' do
|
||||||
let(:types_de_champ) do
|
let(:types_de_champ) do
|
||||||
[
|
[
|
||||||
create(:type_de_champ_public, libelle: 'libelleA'),
|
create(:type_de_champ, libelle: 'libelleA'),
|
||||||
create(:type_de_champ_public, libelle: 'libelleB')
|
create(:type_de_champ, libelle: 'libelleB')
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe Champ do
|
describe Champ do
|
||||||
describe '#private?' do
|
describe '#private?' do
|
||||||
let(:type_de_champ) { build(:type_de_champ_private) }
|
let(:type_de_champ) { build(:type_de_champ, :private) }
|
||||||
let(:champ) { type_de_champ.champ.build }
|
let(:champ) { type_de_champ.champ.build }
|
||||||
|
|
||||||
it { expect(champ.private?).to be_truthy }
|
it { expect(champ.private?).to be_truthy }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
shared_examples 'champ_spec' do
|
shared_examples 'champ_spec' do
|
||||||
describe 'mandatory_and_blank?' do
|
describe 'mandatory_and_blank?' do
|
||||||
let(:type_de_champ) { build(:type_de_champ_public, mandatory: mandatory) }
|
let(:type_de_champ) { build(:type_de_champ, mandatory: mandatory) }
|
||||||
let(:champ) { type_de_champ.champ.build(value: value) }
|
let(:champ) { type_de_champ.champ.build(value: value) }
|
||||||
let(:value) { '' }
|
let(:value) { '' }
|
||||||
let(:mandatory) { true }
|
let(:mandatory) { true }
|
||||||
|
@ -33,7 +33,7 @@ shared_examples 'champ_spec' do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when type_champ=date" do
|
context "when type_champ=date" do
|
||||||
let(:type_de_champ) { create(:type_de_champ_public, type_champ: "date") }
|
let(:type_de_champ) { create(:type_de_champ, type_champ: "date") }
|
||||||
let(:champ) { type_de_champ.champ.create }
|
let(:champ) { type_de_champ.champ.create }
|
||||||
|
|
||||||
it "should convert %d/%m/%Y format to ISO" do
|
it "should convert %d/%m/%Y format to ISO" do
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe Champ do
|
||||||
it_should_behave_like "champ_spec"
|
it_should_behave_like "champ_spec"
|
||||||
|
|
||||||
describe '#public?' do
|
describe '#public?' do
|
||||||
let(:type_de_champ) { build(:type_de_champ_public) }
|
let(:type_de_champ) { build(:type_de_champ) }
|
||||||
let(:champ) { type_de_champ.champ.build }
|
let(:champ) { type_de_champ.champ.build }
|
||||||
|
|
||||||
it { expect(champ.public?).to be_truthy }
|
it { expect(champ.public?).to be_truthy }
|
||||||
|
@ -14,7 +14,7 @@ describe Champ do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#format_datetime' do
|
describe '#format_datetime' do
|
||||||
let(:type_de_champ) { build(:type_de_champ_public, type_champ: 'datetime') }
|
let(:type_de_champ) { build(:type_de_champ, type_champ: 'datetime') }
|
||||||
let(:champ) { type_de_champ.champ.build(value: value) }
|
let(:champ) { type_de_champ.champ.build(value: value) }
|
||||||
|
|
||||||
before { champ.save }
|
before { champ.save }
|
||||||
|
@ -33,7 +33,7 @@ describe Champ do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#multiple_select_to_string' do
|
describe '#multiple_select_to_string' do
|
||||||
let(:type_de_champ) { build(:type_de_champ_public, type_champ: 'multiple_drop_down_list') }
|
let(:type_de_champ) { build(:type_de_champ, type_champ: 'multiple_drop_down_list') }
|
||||||
let(:champ) { type_de_champ.champ.build(value: value) }
|
let(:champ) { type_de_champ.champ.build(value: value) }
|
||||||
|
|
||||||
before { champ.save }
|
before { champ.save }
|
||||||
|
@ -71,7 +71,7 @@ describe Champ do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'for_export' do
|
describe 'for_export' do
|
||||||
let(:type_de_champ) { create(:type_de_champ_public, type_champ: type_champ) }
|
let(:type_de_champ) { create(:type_de_champ, type_champ: type_champ) }
|
||||||
let(:champ) { type_de_champ.champ.build(value: value) }
|
let(:champ) { type_de_champ.champ.build(value: value) }
|
||||||
|
|
||||||
before { champ.save }
|
before { champ.save }
|
||||||
|
|
|
@ -71,8 +71,8 @@ describe TagsSubstitutionConcern, type: :model do
|
||||||
context 'when the procedure has a type de champ named libelleA et libelleB' do
|
context 'when the procedure has a type de champ named libelleA et libelleB' do
|
||||||
let(:types_de_champ) do
|
let(:types_de_champ) do
|
||||||
[
|
[
|
||||||
create(:type_de_champ_public, libelle: 'libelleA'),
|
create(:type_de_champ, libelle: 'libelleA'),
|
||||||
create(:type_de_champ_public, libelle: 'libelleB')
|
create(:type_de_champ, libelle: 'libelleB')
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ describe TagsSubstitutionConcern, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the procedure has a type de champ prive named libelleA' do
|
context 'when the procedure has a type de champ prive named libelleA' do
|
||||||
let(:types_de_champ_private) { [create(:type_de_champ_private, libelle: 'libelleA')] }
|
let(:types_de_champ_private) { [create(:type_de_champ, :private, libelle: 'libelleA')] }
|
||||||
|
|
||||||
context 'and it is used in the template' do
|
context 'and it is used in the template' do
|
||||||
let(:template) { '--libelleA--' }
|
let(:template) { '--libelleA--' }
|
||||||
|
@ -144,13 +144,13 @@ describe TagsSubstitutionConcern, type: :model do
|
||||||
# The dossier just transitionned from brouillon to en construction,
|
# The dossier just transitionned from brouillon to en construction,
|
||||||
# so champs private are not valid tags yet
|
# so champs private are not valid tags yet
|
||||||
|
|
||||||
let(:types_de_champ_private) { [create(:type_de_champ_private, libelle: 'libelleA')] }
|
let(:types_de_champ_private) { [create(:type_de_champ, :private, libelle: 'libelleA')] }
|
||||||
|
|
||||||
it { is_expected.to eq('--libelleA--') }
|
it { is_expected.to eq('--libelleA--') }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'champs publics are valid tags' do
|
context 'champs publics are valid tags' do
|
||||||
let(:types_de_champ) { [create(:type_de_champ_public, libelle: 'libelleA')] }
|
let(:types_de_champ) { [create(:type_de_champ, libelle: 'libelleA')] }
|
||||||
|
|
||||||
before { dossier.champs.first.update_attributes(value: 'libelle1') }
|
before { dossier.champs.first.update_attributes(value: 'libelle1') }
|
||||||
|
|
||||||
|
@ -161,8 +161,8 @@ describe TagsSubstitutionConcern, type: :model do
|
||||||
context 'when the procedure has 2 types de champ date and datetime' do
|
context 'when the procedure has 2 types de champ date and datetime' do
|
||||||
let(:types_de_champ) do
|
let(:types_de_champ) do
|
||||||
[
|
[
|
||||||
create(:type_de_champ_public, libelle: 'date', type_champ: 'date'),
|
create(:type_de_champ, libelle: 'date', type_champ: 'date'),
|
||||||
create(:type_de_champ_public, libelle: 'datetime', type_champ: 'datetime')
|
create(:type_de_champ, libelle: 'datetime', type_champ: 'datetime')
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -224,13 +224,13 @@ describe TagsSubstitutionConcern, type: :model do
|
||||||
|
|
||||||
shared_examples "treat all kinds of space as equivalent" do
|
shared_examples "treat all kinds of space as equivalent" do
|
||||||
context 'and the champ has a non breaking space' do
|
context 'and the champ has a non breaking space' do
|
||||||
let(:types_de_champ) { [create(:type_de_champ_public, libelle: 'mon tag')] }
|
let(:types_de_champ) { [create(:type_de_champ, libelle: 'mon tag')] }
|
||||||
|
|
||||||
it { is_expected.to eq('valeur') }
|
it { is_expected.to eq('valeur') }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and the champ has an ordinary space' do
|
context 'and the champ has an ordinary space' do
|
||||||
let(:types_de_champ) { [create(:type_de_champ_public, libelle: 'mon tag')] }
|
let(:types_de_champ) { [create(:type_de_champ, libelle: 'mon tag')] }
|
||||||
|
|
||||||
it { is_expected.to eq('valeur') }
|
it { is_expected.to eq('valeur') }
|
||||||
end
|
end
|
||||||
|
@ -265,8 +265,8 @@ describe TagsSubstitutionConcern, type: :model do
|
||||||
describe 'tags' do
|
describe 'tags' do
|
||||||
subject { template_concern.tags }
|
subject { template_concern.tags }
|
||||||
|
|
||||||
let(:types_de_champ) { [create(:type_de_champ_public, libelle: 'public')] }
|
let(:types_de_champ) { [create(:type_de_champ, libelle: 'public')] }
|
||||||
let(:types_de_champ_private) { [create(:type_de_champ_private, libelle: 'privé')] }
|
let(:types_de_champ_private) { [create(:type_de_champ, :private, libelle: 'privé')] }
|
||||||
|
|
||||||
context 'when generating a document for a dossier terminé' do
|
context 'when generating a document for a dossier terminé' do
|
||||||
it { is_expected.to include(include({ libelle: 'motivation' })) }
|
it { is_expected.to include(include({ libelle: 'motivation' })) }
|
||||||
|
|
|
@ -349,9 +349,9 @@ describe Dossier do
|
||||||
let(:dossier) { Dossier.create(user: create(:user), procedure: procedure) }
|
let(:dossier) { Dossier.create(user: create(:user), procedure: procedure) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
create(:type_de_champ_public, libelle: 'l1', order_place: 1, procedure: procedure)
|
create(:type_de_champ, libelle: 'l1', order_place: 1, procedure: procedure)
|
||||||
create(:type_de_champ_public, libelle: 'l3', order_place: 3, procedure: procedure)
|
create(:type_de_champ, libelle: 'l3', order_place: 3, procedure: procedure)
|
||||||
create(:type_de_champ_public, libelle: 'l2', order_place: 2, procedure: procedure)
|
create(:type_de_champ, libelle: 'l2', order_place: 2, procedure: procedure)
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(dossier.ordered_champs.pluck(:libelle)).to match(%w(l1 l2 l3)) }
|
it { expect(dossier.ordered_champs.pluck(:libelle)).to match(%w(l1 l2 l3)) }
|
||||||
|
@ -362,9 +362,9 @@ describe Dossier do
|
||||||
let(:dossier) { Dossier.create(user: create(:user), procedure: procedure) }
|
let(:dossier) { Dossier.create(user: create(:user), procedure: procedure) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
create :type_de_champ_private, libelle: 'l1', order_place: 1, procedure: procedure
|
create :type_de_champ, :private, libelle: 'l1', order_place: 1, procedure: procedure
|
||||||
create :type_de_champ_private, libelle: 'l3', order_place: 3, procedure: procedure
|
create :type_de_champ, :private, libelle: 'l3', order_place: 3, procedure: procedure
|
||||||
create :type_de_champ_private, libelle: 'l2', order_place: 2, procedure: procedure
|
create :type_de_champ, :private, libelle: 'l2', order_place: 2, procedure: procedure
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(dossier.ordered_champs_private.pluck(:libelle)).to match(%w(l1 l2 l3)) }
|
it { expect(dossier.ordered_champs_private.pluck(:libelle)).to match(%w(l1 l2 l3)) }
|
||||||
|
|
|
@ -47,14 +47,14 @@ describe DropDownList do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when multiple' do
|
context 'when multiple' do
|
||||||
let(:type_de_champ) { build(:type_de_champ_public, type_champ: 'multiple_drop_down_list') }
|
let(:type_de_champ) { build(:type_de_champ, type_champ: 'multiple_drop_down_list') }
|
||||||
let(:champ) { type_de_champ.champ.build(value: '["1","2"]').decorate }
|
let(:champ) { type_de_champ.champ.build(value: '["1","2"]').decorate }
|
||||||
|
|
||||||
it { expect(dropdownlist.selected_options(champ)).to match(['1', '2']) }
|
it { expect(dropdownlist.selected_options(champ)).to match(['1', '2']) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when simple' do
|
context 'when simple' do
|
||||||
let(:type_de_champ) { build(:type_de_champ_public, type_champ: 'drop_down_list') }
|
let(:type_de_champ) { build(:type_de_champ, type_champ: 'drop_down_list') }
|
||||||
let(:champ) { type_de_champ.champ.build(value: '1').decorate }
|
let(:champ) { type_de_champ.champ.build(value: '1').decorate }
|
||||||
|
|
||||||
it { expect(dropdownlist.selected_options(champ)).to match(['1']) }
|
it { expect(dropdownlist.selected_options(champ)).to match(['1']) }
|
||||||
|
|
|
@ -69,8 +69,8 @@ describe Procedure do
|
||||||
|
|
||||||
describe '#types_de_champ_ordered' do
|
describe '#types_de_champ_ordered' do
|
||||||
let(:procedure) { create(:procedure) }
|
let(:procedure) { create(:procedure) }
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_public, procedure: procedure, order_place: 1) }
|
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 1) }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_public, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure, order_place: 0) }
|
||||||
subject { procedure.types_de_champ_ordered }
|
subject { procedure.types_de_champ_ordered }
|
||||||
it { expect(subject.first).to eq(type_de_champ_1) }
|
it { expect(subject.first).to eq(type_de_champ_1) }
|
||||||
it { expect(subject.last).to eq(type_de_champ_0) }
|
it { expect(subject.last).to eq(type_de_champ_0) }
|
||||||
|
@ -85,8 +85,8 @@ describe Procedure do
|
||||||
it { expect(subject).to eq(false) }
|
it { expect(subject).to eq(false) }
|
||||||
end
|
end
|
||||||
context 'when procedure have 2 types de champ' do
|
context 'when procedure have 2 types de champ' do
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_public, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 0) }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_public, procedure: procedure, order_place: 1) }
|
let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure, order_place: 1) }
|
||||||
context 'when index is not the last element' do
|
context 'when index is not the last element' do
|
||||||
it { expect(subject).to eq(true) }
|
it { expect(subject).to eq(true) }
|
||||||
it 'switch order place' do
|
it 'switch order place' do
|
||||||
|
@ -153,12 +153,12 @@ describe Procedure do
|
||||||
let(:archived_at) { nil }
|
let(:archived_at) { nil }
|
||||||
let(:published_at) { nil }
|
let(:published_at) { nil }
|
||||||
let(:procedure) { create(:procedure, archived_at: archived_at, published_at: published_at, received_mail: received_mail) }
|
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_public, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 0) }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_public, procedure: procedure, order_place: 1) }
|
let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure, order_place: 1) }
|
||||||
let!(:type_de_champ_2) { create(:type_de_champ_public, :type_drop_down_list, procedure: procedure, order_place: 2) }
|
let!(:type_de_champ_2) { create(:type_de_champ, :type_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_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_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, :private, :type_drop_down_list, procedure: procedure, order_place: 2) }
|
||||||
let!(:piece_justificative_0) { create(:type_de_piece_justificative, procedure: procedure, order_place: 0) }
|
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!(:piece_justificative_1) { create(:type_de_piece_justificative, procedure: procedure, order_place: 1) }
|
||||||
let(:received_mail){ create(:received_mail) }
|
let(:received_mail){ create(:received_mail) }
|
||||||
|
@ -342,10 +342,10 @@ describe Procedure do
|
||||||
it { expect(subject[:headers]).to eq(dossier.export_headers) }
|
it { expect(subject[:headers]).to eq(dossier.export_headers) }
|
||||||
|
|
||||||
context 'with ordered champs' do
|
context 'with ordered champs' do
|
||||||
let(:tc_2) { create(:type_de_champ_public, order_place: 2) }
|
let(:tc_2) { create(:type_de_champ, order_place: 2) }
|
||||||
let(:tc_1) { create(:type_de_champ_public, order_place: 1) }
|
let(:tc_1) { create(:type_de_champ, order_place: 1) }
|
||||||
let(:tcp_2) { create(:type_de_champ_private, order_place: 2) }
|
let(:tcp_2) { create(:type_de_champ, :private, order_place: 2) }
|
||||||
let(:tcp_1) { create(:type_de_champ_private, order_place: 1) }
|
let(:tcp_1) { create(:type_de_champ, :private, order_place: 1) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
procedure.types_de_champ << tc_2 << tc_1
|
procedure.types_de_champ << tc_2 << tc_1
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe TypeDeChampPrivate do
|
describe TypeDeChamp do
|
||||||
require 'models/type_de_champ_shared_example'
|
describe '#private?' do
|
||||||
|
let(:type_de_champ) { build(:type_de_champ, :private) }
|
||||||
|
|
||||||
it_should_behave_like "type_de_champ_spec"
|
it { expect(type_de_champ.private?).to be_truthy }
|
||||||
|
it { expect(type_de_champ.public?).to be_falsey }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe TypeDeChampPublic do
|
|
||||||
require 'models/type_de_champ_shared_example'
|
|
||||||
|
|
||||||
it_should_behave_like "type_de_champ_spec"
|
|
||||||
end
|
|
|
@ -1,9 +1,9 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe ChampsService do
|
describe ChampsService do
|
||||||
let(:type_de_champ) { create(:type_de_champ_public) }
|
let(:type_de_champ) { create(:type_de_champ) }
|
||||||
let(:type_de_champ_mandatory) { create(:type_de_champ_public, libelle: 'mandatory', mandatory: true) }
|
let(:type_de_champ_mandatory) { create(:type_de_champ, libelle: 'mandatory', mandatory: true) }
|
||||||
let(:type_de_champ_datetime) { create(:type_de_champ_public, type_champ: :datetime) }
|
let(:type_de_champ_datetime) { create(:type_de_champ, type_champ: :datetime) }
|
||||||
let!(:champ) { type_de_champ.champ.create(value: 'toto') }
|
let!(:champ) { type_de_champ.champ.create(value: 'toto') }
|
||||||
let!(:champ_mandatory_empty) { type_de_champ_mandatory.champ.create }
|
let!(:champ_mandatory_empty) { type_de_champ_mandatory.champ.create }
|
||||||
let!(:champ_datetime) { type_de_champ_datetime.champ.create }
|
let!(:champ_datetime) { type_de_champ_datetime.champ.create }
|
||||||
|
|
|
@ -9,7 +9,7 @@ describe TypesDeChampService do
|
||||||
describe 'the drop down list attributes' do
|
describe 'the drop down list attributes' do
|
||||||
let(:types_de_champ_attributes) do
|
let(:types_de_champ_attributes) do
|
||||||
{
|
{
|
||||||
"0" => {
|
"0": {
|
||||||
libelle: 'top',
|
libelle: 'top',
|
||||||
drop_down_list_attributes: {
|
drop_down_list_attributes: {
|
||||||
value: "un\r\n deux\r\n -- commentaire --\r\n trois",
|
value: "un\r\n deux\r\n -- commentaire --\r\n trois",
|
||||||
|
@ -28,29 +28,34 @@ describe TypesDeChampService do
|
||||||
describe 'reorder the fields' do
|
describe 'reorder the fields' do
|
||||||
let(:types_de_champ_attributes) do
|
let(:types_de_champ_attributes) do
|
||||||
{
|
{
|
||||||
'0' => { 'libelle' => 'a', 'order_place' => '0', 'custom_order_place' => '1' },
|
'0': { 'libelle': 'a', 'order_place': '0', 'custom_order_place': '1' },
|
||||||
'1' => { 'libelle' => 'b', 'order_place' => '1', 'custom_order_place' => '2' }
|
'1': { 'libelle': 'b', 'order_place': '1', 'custom_order_place': '2' }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { result['types_de_champ_attributes'].to_unsafe_hash }
|
subject { result['types_de_champ_attributes'].to_unsafe_hash }
|
||||||
|
|
||||||
it { is_expected.to match({ "0" => { 'libelle' => 'a', 'order_place' => '0' }, "1" => { 'libelle' => 'b', 'order_place' => '1' } }) }
|
it do
|
||||||
|
is_expected.to match({
|
||||||
|
'0': { 'libelle': 'a', 'order_place': '0', 'private': false },
|
||||||
|
'1': { 'libelle': 'b', 'order_place': '1', 'private': false }
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
context 'when the user specifies a position on one element' do
|
context 'when the user specifies a position on one element' do
|
||||||
let(:types_de_champ_attributes) do
|
let(:types_de_champ_attributes) do
|
||||||
{
|
{
|
||||||
'0' => { 'libelle' => 'a', 'order_place' => '1', 'custom_order_place' => '1' },
|
'0': { 'libelle': 'a', 'order_place': '1', 'custom_order_place': '1' },
|
||||||
'1' => { 'libelle' => 'b', 'order_place' => '10', 'custom_order_place' => '10' },
|
'1': { 'libelle': 'b', 'order_place': '10', 'custom_order_place': '10' },
|
||||||
'2' => { 'libelle' => 'c', 'order_place' => '11', 'custom_order_place' => '2' }
|
'2': { 'libelle': 'c', 'order_place': '11', 'custom_order_place': '2' }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it do
|
it do
|
||||||
is_expected.to match({
|
is_expected.to match({
|
||||||
'0' => { 'libelle' => 'a', 'order_place' => '0' },
|
'0': { 'libelle': 'a', 'order_place': '0', 'private': false },
|
||||||
'1' => { 'libelle' => 'c', 'order_place' => '1' },
|
'1': { 'libelle': 'c', 'order_place': '1', 'private': false },
|
||||||
'2' => { 'libelle' => 'b', 'order_place' => '2' }
|
'2': { 'libelle': 'b', 'order_place': '2', 'private': false }
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -58,17 +63,17 @@ describe TypesDeChampService do
|
||||||
context 'when the user puts a champ down' do
|
context 'when the user puts a champ down' do
|
||||||
let(:types_de_champ_attributes) do
|
let(:types_de_champ_attributes) do
|
||||||
{
|
{
|
||||||
'0' => { 'libelle' => 'a', 'order_place' => '0', 'custom_order_place' => '2' },
|
'0': { 'libelle': 'a', 'order_place': '0', 'custom_order_place': '2' },
|
||||||
'1' => { 'libelle' => 'b', 'order_place' => '1', 'custom_order_place' => '2' },
|
'1': { 'libelle': 'b', 'order_place': '1', 'custom_order_place': '2' },
|
||||||
'2' => { 'libelle' => 'c', 'order_place' => '2', 'custom_order_place' => '3' }
|
'2': { 'libelle': 'c', 'order_place': '2', 'custom_order_place': '3' }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it do
|
it do
|
||||||
is_expected.to match({
|
is_expected.to match({
|
||||||
'0' => { 'libelle' => 'b', 'order_place' => '0' },
|
'0': { 'libelle': 'b', 'order_place': '0', 'private': false },
|
||||||
'1' => { 'libelle' => 'a', 'order_place' => '1' },
|
'1': { 'libelle': 'a', 'order_place': '1', 'private': false },
|
||||||
'2' => { 'libelle' => 'c', 'order_place' => '2' }
|
'2': { 'libelle': 'c', 'order_place': '2', 'private': false }
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -76,19 +81,19 @@ describe TypesDeChampService do
|
||||||
context 'when the user uses not a number' do
|
context 'when the user uses not a number' do
|
||||||
let(:types_de_champ_attributes) do
|
let(:types_de_champ_attributes) do
|
||||||
{
|
{
|
||||||
'0' => { 'libelle' => 'a', 'order_place' => '0', 'custom_order_place' => '1' },
|
'0': { 'libelle': 'a', 'order_place': '0', 'custom_order_place': '1' },
|
||||||
'1' => { 'libelle' => 'b', 'order_place' => '1', 'custom_order_place' => '2' },
|
'1': { 'libelle': 'b', 'order_place': '1', 'custom_order_place': '2' },
|
||||||
'2' => { 'libelle' => 'c', 'order_place' => '2', 'custom_order_place' => '' },
|
'2': { 'libelle': 'c', 'order_place': '2', 'custom_order_place': '' },
|
||||||
'3' => { 'libelle' => 'd', 'order_place' => '3', 'custom_order_place' => 'a' }
|
'3': { 'libelle': 'd', 'order_place': '3', 'custom_order_place': 'a' }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not change the natural order' do
|
it 'does not change the natural order' do
|
||||||
is_expected.to match({
|
is_expected.to match({
|
||||||
'0' => { 'libelle' => 'a', 'order_place' => '0' },
|
'0': { 'libelle': 'a', 'order_place': '0', 'private': false },
|
||||||
'1' => { 'libelle' => 'b', 'order_place' => '1' },
|
'1': { 'libelle': 'b', 'order_place': '1', 'private': false },
|
||||||
'2' => { 'libelle' => 'c', 'order_place' => '2' },
|
'2': { 'libelle': 'c', 'order_place': '2', 'private': false },
|
||||||
'3' => { 'libelle' => 'd', 'order_place' => '3' }
|
'3': { 'libelle': 'd', 'order_place': '3', 'private': false }
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,8 +6,8 @@ describe 'admin/types_de_champ/show.html.haml', type: :view do
|
||||||
describe 'fields sorted' do
|
describe 'fields sorted' do
|
||||||
let(:first_libelle) { 'salut la compagnie' }
|
let(:first_libelle) { 'salut la compagnie' }
|
||||||
let(:last_libelle) { 'je suis bien sur la page' }
|
let(:last_libelle) { 'je suis bien sur la page' }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_public, procedure: procedure, order_place: 1, libelle: last_libelle) }
|
let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure, order_place: 1, libelle: last_libelle) }
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_public, procedure: procedure, order_place: 0, libelle: first_libelle) }
|
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 0, libelle: first_libelle) }
|
||||||
before do
|
before do
|
||||||
procedure.reload
|
procedure.reload
|
||||||
assign(:procedure, procedure)
|
assign(:procedure, procedure)
|
||||||
|
@ -32,15 +32,15 @@ describe 'admin/types_de_champ/show.html.haml', type: :view do
|
||||||
it { expect(subject).not_to have_css('.fa-chevron-up') }
|
it { expect(subject).not_to have_css('.fa-chevron-up') }
|
||||||
end
|
end
|
||||||
context 'when there is only one field in database' do
|
context 'when there is only one field in database' do
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_public, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 0) }
|
||||||
it { expect(subject).to have_css('#btn_down_0[style*="visibility: hidden"]') }
|
it { expect(subject).to have_css('#btn_down_0[style*="visibility: hidden"]') }
|
||||||
it { expect(subject).to have_css('#btn_up_0[style*="visibility: hidden"]') }
|
it { expect(subject).to have_css('#btn_up_0[style*="visibility: hidden"]') }
|
||||||
it { expect(subject).not_to have_css('#btn_up_1') }
|
it { expect(subject).not_to have_css('#btn_up_1') }
|
||||||
it { expect(subject).not_to have_css('#btn_down_1') }
|
it { expect(subject).not_to have_css('#btn_down_1') }
|
||||||
end
|
end
|
||||||
context 'when there are 2 fields in database' do
|
context 'when there are 2 fields in database' do
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_public, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 0) }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_public, procedure: procedure, order_place: 1) }
|
let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure, order_place: 1) }
|
||||||
it { expect(subject).to have_css('#btn_down_0') }
|
it { expect(subject).to have_css('#btn_down_0') }
|
||||||
it { expect(subject).to have_css('#btn_up_0[style*="visibility: hidden"]') }
|
it { expect(subject).to have_css('#btn_up_0[style*="visibility: hidden"]') }
|
||||||
it { expect(subject).to have_css('#btn_up_1') }
|
it { expect(subject).to have_css('#btn_up_1') }
|
||||||
|
|
|
@ -6,8 +6,8 @@ describe 'admin/types_de_champ/show.html.haml', type: :view do
|
||||||
describe 'fields sorted' do
|
describe 'fields sorted' do
|
||||||
let(:first_libelle) { 'salut la compagnie' }
|
let(:first_libelle) { 'salut la compagnie' }
|
||||||
let(:last_libelle) { 'je suis bien sur la page' }
|
let(:last_libelle) { 'je suis bien sur la page' }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_private, procedure: procedure, order_place: 1, libelle: last_libelle) }
|
let!(:type_de_champ_1) { create(:type_de_champ, :private, procedure: procedure, order_place: 1, libelle: last_libelle) }
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_private, procedure: procedure, order_place: 0, libelle: first_libelle) }
|
let!(:type_de_champ_0) { create(:type_de_champ, :private, procedure: procedure, order_place: 0, libelle: first_libelle) }
|
||||||
before do
|
before do
|
||||||
procedure.reload
|
procedure.reload
|
||||||
assign(:procedure, procedure)
|
assign(:procedure, procedure)
|
||||||
|
@ -40,15 +40,15 @@ describe 'admin/types_de_champ/show.html.haml', type: :view do
|
||||||
it { expect(subject).not_to have_css('.fa-chevron-up') }
|
it { expect(subject).not_to have_css('.fa-chevron-up') }
|
||||||
end
|
end
|
||||||
context 'when there is only one field in database' do
|
context 'when there is only one field in database' do
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_private, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, :private, procedure: procedure, order_place: 0) }
|
||||||
it { expect(subject).to have_css('#btn_down_0[style*="visibility: hidden"]') }
|
it { expect(subject).to have_css('#btn_down_0[style*="visibility: hidden"]') }
|
||||||
it { expect(subject).to have_css('#btn_up_0[style*="visibility: hidden"]') }
|
it { expect(subject).to have_css('#btn_up_0[style*="visibility: hidden"]') }
|
||||||
it { expect(subject).not_to have_css('#btn_up_1') }
|
it { expect(subject).not_to have_css('#btn_up_1') }
|
||||||
it { expect(subject).not_to have_css('#btn_down_1') }
|
it { expect(subject).not_to have_css('#btn_down_1') }
|
||||||
end
|
end
|
||||||
context 'when there are 2 fields in database' do
|
context 'when there are 2 fields in database' do
|
||||||
let!(:type_de_champ_0) { create(:type_de_champ_private, procedure: procedure, order_place: 0) }
|
let!(:type_de_champ_0) { create(:type_de_champ, :private, procedure: procedure, order_place: 0) }
|
||||||
let!(:type_de_champ_1) { create(:type_de_champ_private, procedure: procedure, order_place: 1) }
|
let!(:type_de_champ_1) { create(:type_de_champ, :private, procedure: procedure, order_place: 1) }
|
||||||
it { expect(subject).to have_css('#btn_down_0') }
|
it { expect(subject).to have_css('#btn_down_0') }
|
||||||
it { expect(subject).to have_css('#btn_up_0[style*="visibility: hidden"]') }
|
it { expect(subject).to have_css('#btn_up_0[style*="visibility: hidden"]') }
|
||||||
it { expect(subject).to have_css('#btn_up_1') }
|
it { expect(subject).to have_css('#btn_up_1') }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'users/description/champs/date.html.haml', type: :view do
|
describe 'users/description/champs/date.html.haml', type: :view do
|
||||||
let(:type_champ) { create(:type_de_champ_public, type_champ: :date) }
|
let(:type_champ) { create(:type_de_champ, type_champ: :date) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
render 'users/description/champs/date.html.haml', champ: champ
|
render 'users/description/champs/date.html.haml', champ: champ
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'users/description/champs/dossier_link.html.haml', type: :view do
|
describe 'users/description/champs/dossier_link.html.haml', type: :view do
|
||||||
let(:type_champ) { create(:type_de_champ_public, type_champ: :dossier_link) }
|
let(:type_champ) { create(:type_de_champ, type_champ: :dossier_link) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
render 'users/description/champs/dossier_link.html.haml', champ: champ
|
render 'users/description/champs/dossier_link.html.haml', champ: champ
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'users/description/champs/engagement.html.haml', type: :view do
|
describe 'users/description/champs/engagement.html.haml', type: :view do
|
||||||
let(:type_champ) { create(:type_de_champ_public, type_champ: :engagement) }
|
let(:type_champ) { create(:type_de_champ, type_champ: :engagement) }
|
||||||
|
|
||||||
subject { render 'users/description/champs/engagement.html.haml', champ: champ }
|
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
|
describe 'users/description/champs/render_list_champs.html.haml', type: :view do
|
||||||
let(:type_champ) { create(:type_de_champ_public, :checkbox) }
|
let(:type_champ) { create(:type_de_champ, :checkbox) }
|
||||||
|
|
||||||
context "with any champ" do
|
context "with any champ" do
|
||||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: nil) }
|
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
|
end
|
||||||
|
|
||||||
context 'with a dossier_link' do
|
context 'with a dossier_link' do
|
||||||
let(:type_champ) { create(:type_de_champ_public, type_champ: :dossier_link) }
|
let(:type_champ) { create(:type_de_champ, type_champ: :dossier_link) }
|
||||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: nil) }
|
let!(:champ) { create(:champ, type_de_champ: type_champ, value: nil) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'users/description/champs/yes_no.html.haml', type: :view do
|
describe 'users/description/champs/yes_no.html.haml', type: :view do
|
||||||
let(:type_champ) { create(:type_de_champ_public, type_champ: :yes_no) }
|
let(:type_champ) { create(:type_de_champ, type_champ: :yes_no) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
render 'users/description/champs/yes_no.html.haml', champ: champ
|
render 'users/description/champs/yes_no.html.haml', champ: champ
|
||||||
|
|
Loading…
Reference in a new issue