demarches-normaliennes/spec/helpers/dossier_helper_spec.rb

29 lines
729 B
Ruby
Raw Normal View History

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