1 # frozen_string_literal: true
6 class ChangesetCommentViewTest < ActionView::TestCase
7 def test_render_without_summary
8 changeset_comment = build_stubbed(
10 :body => "Insightful comment"
13 notification = build_stubbed(:notification, :record => changeset_comment)
16 "notifications/notification",
17 :notification => notification
20 assert_dom ".web-notification" do
21 assert_dom "h2", "Changeset comment"
22 assert_not_dom "p", /\("/
23 assert_dom "time", "less than 1 minute ago"
24 assert_dom "blockquote", "Insightful comment"
28 def test_render_with_summary
29 summary_tag = build_stubbed(
32 :v => "This is a summary"
34 changeset = build_stubbed(:changeset, :changeset_tags => [summary_tag])
35 changeset_comment = build_stubbed(
37 :changeset => changeset,
38 :body => "Insightful comment"
40 notification = build_stubbed(:notification, :record => changeset_comment)
43 "notifications/notification",
44 :notification => notification
47 assert_dom ".web-notification" do
48 assert_dom "h2", "Changeset comment"
49 assert_dom "time", "less than 1 minute ago"
50 assert_dom ".event-description", /\("This is a summary"\)/
51 assert_dom "blockquote", "Insightful comment"
55 def test_render_with_long_text
56 comment_author = build_stubbed(
58 :display_name => "Helpful Commenter"
60 changeset = build_stubbed(:changeset)
61 changeset_comment = build_stubbed(
63 :author => comment_author,
64 :changeset => changeset,
65 :body => read_fixture_file("lorem_ipsum.txt")
68 notification = build_stubbed(:notification, :record => changeset_comment)
71 "notifications/notification",
72 :notification => notification
75 assert_dom ".web-notification blockquote p", :count => 3