Skip to content

Commit 28a07cc

Browse files
committed
adds additional cases for marked as read status
1 parent 42fefc5 commit 28a07cc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

spec/features/notifications/mark_as_read_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,21 @@
2222
sign_in_user(user.email, user.password)
2323
end
2424

25+
it 'will not be marked as read if conversation is not loaded', :js do
26+
create_list(:message, 2, conversation: conversation)
27+
expect(user.person.notifications.map(&:read_at)).to all(eq(nil))
28+
end
29+
2530
it 'marked as read when conversation is loaded', :js do
2631
create_list(:message, 2, conversation: conversation)
2732
visit conversation_path(id: conversation, person_id: user.person, locale: I18n.default_locale)
2833
expect(user.person.notifications.map(&:read_at)).to all(be_a(Time))
2934
end
35+
36+
# TODO: test for automatic update of read_at when page is active
37+
# it 'marked as read while conversation page is active', :js do
38+
# visit conversation_path(id: conversation, person_id: user.person, locale: I18n.default_locale)
39+
# create_list(:message, 2, conversation: conversation)
40+
# expect(user.person.notifications.map(&:read_at)).to all(be_a(Time))
41+
# end
3042
end

0 commit comments

Comments
 (0)