]> git.openstreetmap.org Git - rails.git/blob - test/system/report_note_test.rb
Add frozen_string_literal comments to ruby files
[rails.git] / test / system / report_note_test.rb
1 # frozen_string_literal: true
2
3 require "application_system_test_case"
4
5 class ReportNoteTest < ApplicationSystemTestCase
6   def test_no_link_when_not_logged_in
7     note = create(:note_with_comments)
8     visit note_path(note)
9     assert_content note.description
10
11     assert_no_content I18n.t("notes.show.report")
12   end
13
14   def test_can_report_anonymous_notes
15     note = create(:note_with_comments)
16     sign_in_as(create(:user))
17     visit note_path(note)
18
19     click_on I18n.t("notes.show.report")
20     assert_content "Report"
21     assert_content I18n.t("reports.new.disclaimer.intro")
22
23     choose I18n.t("reports.new.categories.note.spam_label")
24     fill_in "report_details", :with => "This is spam"
25     assert_difference "Issue.count", 1 do
26       click_on "Create Report"
27     end
28
29     assert_content "Your report has been registered successfully"
30
31     assert_equal note, Issue.last.reportable
32     assert_equal "moderator", Issue.last.assigned_role
33   end
34
35   def test_can_report_notes_with_author
36     user = create(:user)
37     note = create(:note_comment, :author => user, :note => build(:note, :author => user)).note
38     sign_in_as(create(:user))
39     visit note_path(note)
40
41     click_on I18n.t("notes.show.report")
42     assert_content "Report"
43     assert_content I18n.t("reports.new.disclaimer.intro")
44
45     choose I18n.t("reports.new.categories.note.spam_label")
46     fill_in "report_details", :with => "This is spam"
47     assert_difference "Issue.count", 1 do
48       click_on "Create Report"
49     end
50
51     assert_content "Your report has been registered successfully"
52
53     assert_equal note, Issue.last.reportable
54     assert_equal "moderator", Issue.last.assigned_role
55   end
56 end