1 require "application_system_test_case"
3 class ReportUserTest < 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_not page.has_content?(I18n.t("user.view.report"))
12 def test_can_report_user
14 sign_in_as(create(:user))
15 visit user_path(user.display_name)
17 click_on I18n.t("user.view.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.user.vandal")
22 fill_in "report_details", :with => "This user is a vandal"
23 assert_difference "Issue.count", 1 do
24 click_on "Create Report"
27 assert page.has_content? "Your report has been registered sucessfully"
29 assert_equal user, Issue.last.reportable