]> git.openstreetmap.org Git - rails.git/blob - test/system/report_diary_comment_test.rb
Update bundle
[rails.git] / test / system / report_diary_comment_test.rb
1 require "application_system_test_case"
2
3 class ReportDiaryCommentTest < ApplicationSystemTestCase
4   def setup
5     create(:language, :code => "en")
6     @diary_entry = create(:diary_entry)
7     @comment = create(:diary_comment, :diary_entry => @diary_entry)
8   end
9
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
13
14     assert_no_content I18n.t("diary_entries.diary_comment.report")
15   end
16
17   def test_it_works
18     sign_in_as(create(:user))
19     visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
20     assert_content @diary_entry.title
21
22     click_on I18n.t("diary_entries.diary_comment.report")
23     assert_content "Report"
24     assert_content I18n.t("reports.new.disclaimer.intro")
25
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"
30     end
31
32     assert_content "Your report has been registered successfully"
33
34     assert_equal @comment, Issue.last.reportable
35     assert_equal "administrator", Issue.last.assigned_role
36   end
37 end