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)
6 visit browse_note_path(note)
7 assert page.has_content?(note.comments.first.body)
9 assert !page.has_content?(I18n.t("browse.note.report"))
12 def test_can_report_anonymous_notes
13 note = create(:note_with_comments)
14 sign_in_as(create(:user))
15 visit browse_note_path(note)
17 click_on I18n.t("browse.note.report")
18 assert page.has_content? "Report"
19 assert page.has_content? I18n.t("reports.new.disclaimer.intro")
21 choose I18n.t("reports.new.categories.note.spam")
22 fill_in "report_details", :with => "This is spam"
23 click_on "Create Report"
25 assert page.has_content? "Your report has been registered sucessfully"
27 assert_equal 1, Issue.count
28 assert Issue.last.reportable == note
31 def test_can_report_notes_with_author
32 note = create(:note_comment, :author => create(:user)).note
33 sign_in_as(create(:user))
34 visit browse_note_path(note)
36 click_on I18n.t("browse.note.report")
37 assert page.has_content? "Report"
38 assert page.has_content? I18n.t("reports.new.disclaimer.intro")
40 choose I18n.t("reports.new.categories.note.spam")
41 fill_in "report_details", :with => "This is spam"
42 click_on "Create Report"
44 assert page.has_content? "Your report has been registered sucessfully"
46 assert_equal 1, Issue.count
47 assert Issue.last.reportable == note