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"
12 notification = build_stubbed(:notification, :record => changeset_comment)
13 notification_wrapper = UserNotifications::ChangesetCommentNotification.new(notification)
15 render "notifications/changeset_comment", :notification => notification_wrapper
17 assert_dom ".user-notification" do
18 assert_dom "h2", "Changeset comment"
19 assert_not_dom "p", /\("/
20 assert_dom "time", "less than 1 minute ago"
21 assert_dom "blockquote", "Insightful comment"
25 def test_render_with_summary
26 summary_tag = build_stubbed(
29 :v => "This is a summary"
31 changeset = build_stubbed(:changeset, :changeset_tags => [summary_tag])
32 changeset_comment = build_stubbed(
34 :changeset => changeset,
35 :body => "Insightful comment"
37 notification = build_stubbed(:notification, :record => changeset_comment)
38 notification_wrapper = UserNotifications::ChangesetCommentNotification.new(notification)
40 render "notifications/changeset_comment", :notification => notification_wrapper
42 assert_dom ".user-notification" do
43 assert_dom "h2", "Changeset comment"
44 assert_dom "time", "less than 1 minute ago"
45 assert_dom ".event-description", /\("This is a summary"\)/
46 assert_dom "blockquote", "Insightful comment"