Do not allow to filter by explication fields
This commit is contained in:
parent
c586474a45
commit
a611cace5f
2 changed files with 20 additions and 7 deletions
|
@ -215,11 +215,17 @@ class Procedure < ActiveRecord::Base
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
types_de_champ.reject { |tdc| tdc.type_champ == 'header_section' }.each do |type_de_champ|
|
types_de_champ
|
||||||
|
.reject { |tdc| ['header_section', 'explication'].include?(tdc.type_champ ) }
|
||||||
|
.each do |type_de_champ|
|
||||||
|
|
||||||
fields << field_hash(type_de_champ.libelle, 'type_de_champ', type_de_champ.id.to_s)
|
fields << field_hash(type_de_champ.libelle, 'type_de_champ', type_de_champ.id.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
types_de_champ_private.reject { |tdc| tdc.type_champ == 'header_section' }.each do |type_de_champ|
|
types_de_champ_private
|
||||||
|
.reject { |tdc| ['header_section', 'explication'].include?(tdc.type_champ ) }
|
||||||
|
.each do |type_de_champ|
|
||||||
|
|
||||||
fields << field_hash(type_de_champ.libelle, 'type_de_champ_private', type_de_champ.id.to_s)
|
fields << field_hash(type_de_champ.libelle, 'type_de_champ_private', type_de_champ.id.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -423,11 +423,11 @@ describe Procedure do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#fields" do
|
describe "#fields" do
|
||||||
subject { create(:procedure, :with_type_de_champ, :with_type_de_champ_private, :types_de_champ_count => 2, :types_de_champ_private_count => 2) }
|
subject { create(:procedure, :with_type_de_champ, :with_type_de_champ_private, :types_de_champ_count => 4, :types_de_champ_private_count => 4) }
|
||||||
let(:tdc_1) { subject.types_de_champ.first }
|
let(:tdc_1) { subject.types_de_champ[0] }
|
||||||
let(:tdc_2) { subject.types_de_champ.last }
|
let(:tdc_2) { subject.types_de_champ[1] }
|
||||||
let(:tdc_private_1) { subject.types_de_champ_private.first }
|
let(:tdc_private_1) { subject.types_de_champ_private[0] }
|
||||||
let(:tdc_private_2) { subject.types_de_champ_private.last }
|
let(:tdc_private_2) { subject.types_de_champ_private[1] }
|
||||||
let(:expected) {
|
let(:expected) {
|
||||||
[
|
[
|
||||||
{ "label" => 'Créé le', "table" => 'self', "column" => 'created_at' },
|
{ "label" => 'Créé le', "table" => 'self', "column" => 'created_at' },
|
||||||
|
@ -452,6 +452,13 @@ describe Procedure do
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
before do
|
||||||
|
subject.types_de_champ[2].update_attribute(:type_champ, 'header_section')
|
||||||
|
subject.types_de_champ[3].update_attribute(:type_champ, 'explication')
|
||||||
|
subject.types_de_champ_private[2].update_attribute(:type_champ, 'header_section')
|
||||||
|
subject.types_de_champ_private[3].update_attribute(:type_champ, 'explication')
|
||||||
|
end
|
||||||
|
|
||||||
it { expect(subject.fields).to eq(expected) }
|
it { expect(subject.fields).to eq(expected) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue