1 # frozen_string_literal: true
6 class NoteCommentViewTest < ActionView::TestCase
7 def test_render_commented
8 note_comment = build_stubbed(
10 :author => build_stubbed(:user),
13 notification = build_stubbed(:notification, :record => note_comment)
16 "notifications/notification",
17 :notification => notification
20 assert_dom ".web-notification" do
21 assert_dom "h2", "Note comment"
22 assert_dom "time", "less than 1 minute ago"
23 assert_dom "blockquote", note_comment.body
27 def test_render_closed_with_comment
28 comment_author = build_stubbed(
30 :display_name => "Helpful Commenter"
32 note = build_stubbed(:note)
33 note_comment = build_stubbed(
35 :author => comment_author,
39 notification = build_stubbed(:notification, :record => note_comment)
42 "notifications/notification",
43 :notification => notification
46 assert_dom ".web-notification" do
47 assert_dom "h2", "Note resolved"
48 assert_dom "time", "less than 1 minute ago"
49 assert_dom "blockquote", note_comment.body
53 def test_render_closed_without_comment
54 comment_author = build_stubbed(
56 :display_name => "Helpful Commenter"
58 note = build_stubbed(:note)
59 note_comment = build_stubbed(
61 :author => comment_author,
66 notification = build_stubbed(:notification, :record => note_comment)
69 "notifications/notification",
70 :notification => notification
73 assert_dom ".web-notification" do
74 assert_dom "h2", "Note resolved"
75 assert_dom "time", "less than 1 minute ago"
76 assert_not_dom "blockquote"
80 def test_render_reopened
81 comment_author = build_stubbed(
83 :display_name => "Helpful Commenter"
85 note = build_stubbed(:note)
86 note_comment = build_stubbed(
88 :author => comment_author,
93 notification = build_stubbed(:notification, :record => note_comment)
96 "notifications/notification",
97 :notification => notification
100 assert_dom ".web-notification" do
101 assert_dom "h2", "Note reopened"
102 assert_dom "time", "less than 1 minute ago"
103 assert_not_dom "blockquote"