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 page.has_content?(@comment.body)
14 assert_not page.has_content?(I18n.t("diary_entry.diary_comment.report"))
18 sign_in_as(create(:user))
19 visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
20 assert page.has_content? @diary_entry.title
22 click_on I18n.t("diary_entry.diary_comment.report")
23 assert page.has_content? "Report"
24 assert page.has_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_on "Create Report"
32 assert page.has_content? "Your report has been registered sucessfully"
34 assert_equal @comment, Issue.last.reportable