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