1 require "application_system_test_case"
3 class ReportDiaryCommentTest < ApplicationSystemTestCase
5 create(:language, :code => "en")
6 @diary_entry = create(:diary_entry)
7 @comment = create(:diary_comment, :diary_entry => @diary_entry)
10 def test_no_link_when_not_logged_in
11 visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
12 assert_content @comment.body
14 assert_no_content I18n.t("diary_entries.diary_comment.report")
18 sign_in_as(create(:user))
19 visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
20 assert_content @diary_entry.title
22 click_link I18n.t("diary_entries.diary_comment.report")
23 assert_content "Report"
24 assert_content I18n.t("reports.new.disclaimer.intro")
26 choose I18n.t("reports.new.categories.diary_comment.spam_label")
27 fill_in "report_details", :with => "This comment is spam"
28 assert_difference "Issue.count", 1 do
29 click_button "Create Report"
32 assert_content "Your report has been registered successfully"
34 assert_equal @comment, Issue.last.reportable
35 assert_equal "administrator", Issue.last.assigned_role