[Fix #1016] display notifications for champs publics

This commit is contained in:
Mathieu Magnin 2017-12-05 16:07:05 +01:00
parent dfbd52c7a0
commit c6be745067
12 changed files with 81 additions and 13 deletions

View file

@ -1,12 +1,14 @@
describe 'new_gestionnaire/dossiers/champs.html.haml', type: :view do
let(:gestionnaire) { create(:gestionnaire) }
let(:demande_seen_at) { nil }
before do
view.extend DossierHelper
view.extend DossierLinkHelper
allow(view).to receive(:current_gestionnaire).and_return(gestionnaire)
end
subject { render 'new_gestionnaire/dossiers/champs.html.haml', champs: champs }
subject { render 'new_gestionnaire/dossiers/champs.html.haml', champs: champs, demande_seen_at: demande_seen_at }
context "there are some champs" do
let(:dossier) { create(:dossier) }
@ -48,4 +50,22 @@ describe 'new_gestionnaire/dossiers/champs.html.haml', type: :view do
it { is_expected.to include("Pas de dossier associé") }
end
context "with seen_at" do
let(:dossier) { create(:dossier) }
let(:champ1) { create(:champ, :checkbox, value: "true") }
let(:champs) { [champ1] }
context "with a demande_seen_at after champ updated_at" do
let(:demande_seen_at) { champ1.updated_at + 1.hour }
it { is_expected.not_to have_css(".highlighted") }
end
context "with a demande_seen_at after champ updated_at" do
let(:demande_seen_at) { champ1.updated_at - 1.hour }
it { is_expected.to have_css(".highlighted") }
end
end
end

View file

@ -1,4 +1,6 @@
describe 'new_gestionnaire/dossiers/show.html.haml', type: :view do
before { view.extend DossierHelper }
let(:current_gestionnaire) { create(:gestionnaire) }
let(:individual) { nil }
let(:entreprise) { nil }