]> git.openstreetmap.org Git - rails.git/blob - test/system/report_anonymous_note_test.rb
Add a redirect and error message if user ends up trying to report something without...
[rails.git] / test / system / report_anonymous_note_test.rb
1 require "application_system_test_case"
2
3 class ReportAnonymousNoteTest < ApplicationSystemTestCase
4   def test_no_flag_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)
8
9     assert !page.has_content?("\u2690")
10   end
11
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)
16
17     click_on "\u2690"
18     assert page.has_content? "Report"
19     assert page.has_content? I18n.t("issues.new.disclaimer.intro")
20
21     choose I18n.t("reports.categories.note.spam")
22     fill_in "report_details", :with => "This is spam"
23     click_on "Create Report"
24
25     assert page.has_content? "Your report has been registered sucessfully"
26
27     assert_equal 1, Issue.count
28     assert Issue.last.reportable == note
29   end
30 end