1 require "application_system_test_case"
3 class ReportNoteTest < ApplicationSystemTestCase
4 def test_no_link_when_not_logged_in
5 note = create(:note_with_comments)
7 assert_content note.description
9 assert_no_content I18n.t("notes.show.report")
12 def test_can_report_anonymous_notes
13 note = create(:note_with_comments)
14 sign_in_as(create(:user))
17 click_on I18n.t("notes.show.report")
18 assert_content "Report"
19 assert_content I18n.t("reports.new.disclaimer.intro")
21 choose I18n.t("reports.new.categories.note.spam_label")
22 fill_in "report_details", :with => "This is spam"
23 assert_difference "Issue.count", 1 do
24 click_on "Create Report"
27 assert_content "Your report has been registered successfully"
29 assert_equal note, Issue.last.reportable
30 assert_equal "moderator", Issue.last.assigned_role
33 def test_can_report_notes_with_author
35 note = create(:note_comment, :author => user, :note => build(:note, :author => user)).note
36 sign_in_as(create(:user))
39 click_on I18n.t("notes.show.report")
40 assert_content "Report"
41 assert_content I18n.t("reports.new.disclaimer.intro")
43 choose I18n.t("reports.new.categories.note.spam_label")
44 fill_in "report_details", :with => "This is spam"
45 assert_difference "Issue.count", 1 do
46 click_on "Create Report"
49 assert_content "Your report has been registered successfully"
51 assert_equal note, Issue.last.reportable
52 assert_equal "moderator", Issue.last.assigned_role