Do not show explication fields to gestionnaires
This commit is contained in:
parent
9578e8d524
commit
c586474a45
4 changed files with 14 additions and 2 deletions
|
@ -5,7 +5,7 @@
|
|||
- if c.type_champ == "header_section"
|
||||
%th.header-section{ colspan: 2 }
|
||||
= c.libelle
|
||||
- else
|
||||
- elsif c.type_champ != "explication"
|
||||
%th
|
||||
= "#{c.libelle} :"
|
||||
%td
|
||||
|
|
|
@ -9,5 +9,9 @@ FactoryGirl.define do
|
|||
trait :header_section do
|
||||
type_de_champ { FactoryGirl.create(:type_de_champ_public, :header_section) }
|
||||
end
|
||||
|
||||
trait :explication do
|
||||
type_de_champ { FactoryGirl.create(:type_de_champ_public, :explication) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,6 +14,10 @@ FactoryGirl.define do
|
|||
type_champ 'header_section'
|
||||
end
|
||||
|
||||
trait :explication do
|
||||
type_champ 'explication'
|
||||
end
|
||||
|
||||
trait :type_dossier_link do
|
||||
libelle 'Référence autre dossier'
|
||||
type_champ 'dossier_link'
|
||||
|
|
|
@ -4,12 +4,16 @@ describe 'new_gestionnaire/dossiers/champs.html.haml', type: :view do
|
|||
context "there is some champs" do
|
||||
let(:champ1) { create(:champ, :checkbox, value: "true") }
|
||||
let(:champ2) { create(:champ, :header_section, value: "Section") }
|
||||
let(:champs) { [champ1, champ2] }
|
||||
let(:champ3) { create(:champ, :explication, value: "mazette") }
|
||||
let(:champs) { [champ1, champ2, champ3] }
|
||||
|
||||
it { expect(rendered).to include(champ1.libelle) }
|
||||
it { expect(rendered).to include(champ1.value) }
|
||||
|
||||
it { expect(rendered).to have_css(".header-section") }
|
||||
it { expect(rendered).to include(champ2.libelle) }
|
||||
|
||||
it { expect(rendered).not_to include(champ3.libelle) }
|
||||
it { expect(rendered).not_to include(champ3.value) }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue