Skip to content

Commit 42fefc5

Browse files
committed
adds spec for message notifications to be marked as read when conversation is loaded
1 parent f111da3 commit 42fefc5

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# frozen_string_literal: true
2+
3+
require 'rails_helper'
4+
5+
RSpec.describe 'message notifications', type: :feature do
6+
include BetterTogether::DeviseSessionHelpers
7+
8+
let(:user) { create(:user, :confirmed) }
9+
let(:conversation) { create(:conversation) }
10+
let!(:conversation_participant) do
11+
create(:conversation_participant,
12+
conversation: conversation,
13+
person: user.person)
14+
end
15+
let(:cp) do
16+
create(:conversation_participant,
17+
conversation: conversation)
18+
end
19+
20+
before do
21+
configure_host_platform
22+
sign_in_user(user.email, user.password)
23+
end
24+
25+
it 'marked as read when conversation is loaded', :js do
26+
create_list(:message, 2, conversation: conversation)
27+
visit conversation_path(id: conversation, person_id: user.person, locale: I18n.default_locale)
28+
expect(user.person.notifications.map(&:read_at)).to all(be_a(Time))
29+
end
30+
end

0 commit comments

Comments
 (0)