-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix #1016] display notifications for champs publics
- Loading branch information
Showing
11 changed files
with
85 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 34 additions & 17 deletions
51
spec/views/new_gestionnaire/dossiers/_champs.html.haml_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,48 @@ | ||
describe 'new_gestionnaire/dossiers/champs.html.haml', type: :view do | ||
before { render 'new_gestionnaire/dossiers/champs.html.haml', champs: champs } | ||
before { view.extend DossierHelper } | ||
|
||
context "there are some champs" do | ||
let(:dossier) { create(:dossier) } | ||
let(:champ1) { create(:champ, :checkbox, value: "true") } | ||
let(:champ2) { create(:champ, :header_section, value: "Section") } | ||
let(:champ3) { create(:champ, :explication, value: "mazette") } | ||
let(:champ4) { create(:champ, :dossier_link, value: dossier.id) } | ||
let(:champs) { [champ1, champ2, champ3, champ4] } | ||
subject { render 'new_gestionnaire/dossiers/champs.html.haml', champs: champs, dossier: dossier, follow: follow } | ||
|
||
let(:dossier) { create(:dossier) } | ||
let(:champ1) { create(:champ, :checkbox, value: "true") } | ||
let(:champ2) { create(:champ, :header_section, value: "Section") } | ||
let(:champ3) { create(:champ, :explication, value: "mazette") } | ||
let(:champ4) { create(:champ, :dossier_link, value: dossier.id) } | ||
let(:champs) { [champ1, champ2, champ3, champ4] } | ||
let(:seen_at) { champ1.updated_at + 1.hour } | ||
let(:follow) { create(:follow, gestionnaire: create(:gestionnaire), dossier: dossier, demande_seen_at: seen_at) } | ||
|
||
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) } | ||
context "there are some champs" do | ||
it { is_expected.to include(champ1.libelle) } | ||
it { is_expected.to include(champ1.value) } | ||
|
||
it { expect(rendered).not_to include(champ3.libelle) } | ||
it { expect(rendered).not_to include(champ3.value) } | ||
it { is_expected.to have_css(".header-section") } | ||
it { is_expected.to include(champ2.libelle) } | ||
|
||
it { expect(rendered).to have_link("Dossier nº #{dossier.id}") } | ||
it { expect(rendered).to include(dossier.text_summary) } | ||
it { is_expected.not_to include(champ3.libelle) } | ||
it { is_expected.not_to include(champ3.value) } | ||
|
||
it { is_expected.to have_link("Dossier nº #{dossier.id}") } | ||
it { is_expected.to include(dossier.text_summary) } | ||
end | ||
|
||
context "with a dossier_link champ but without value" do | ||
let(:champ) { create(:champ, :dossier_link, value: nil) } | ||
let(:champs) { [champ] } | ||
|
||
it { expect(rendered).to include("Pas de dossier associé") } | ||
it { is_expected.to include("Pas de dossier associé") } | ||
end | ||
|
||
context "with a seen_at after champ updated_at" do | ||
let(:seen_at) { champ1.updated_at + 1.hour } | ||
|
||
it { is_expected.not_to have_css(".highlighted") } | ||
end | ||
|
||
context "with a seen_at after champ updated_at" do | ||
let(:seen_at) { champ1.updated_at - 1.hour } | ||
|
||
it { is_expected.to have_css(".highlighted") } | ||
end | ||
end |