[Fix #1016] display notifications for new messages

This commit is contained in:
Mathieu Magnin 2017-12-05 17:20:10 +01:00
parent 5474ff8bb4
commit 8e67e5c057
7 changed files with 79 additions and 7 deletions

View file

@ -0,0 +1,28 @@
require 'rails_helper'
RSpec.describe DossierHelper, type: :helper do
describe ".highlight_if_unseen_class" do
let(:seen_at) { DateTime.now }
subject { highlight_if_unseen_class(seen_at, updated_at) }
context "when commentaire date is created before last seen datetime" do
let(:updated_at) { seen_at - 2.days }
it { is_expected.to eq nil }
end
context "when commentaire date is created after last seen datetime" do
let(:updated_at) { seen_at + 2.hours }
it { is_expected.to eq "highlighted" }
end
context "when there is no last seen datetime" do
let(:updated_at) { DateTime.now }
let(:seen_at) { nil }
it { is_expected.to eq nil }
end
end
end