1 require "application_system_test_case"
3 class IssuesTest < ApplicationSystemTestCase
4 def test_view_issues_normal_user
5 sign_in_as(create(:user))
8 assert page.has_content?(I18n.t("application.require_admin.not_an_admin"))
11 def test_view_no_issues
12 sign_in_as(create(:moderator_user))
15 assert page.has_content?(I18n.t(".issues.index.search.issues_not_found"))
19 sign_in_as(create(:moderator_user))
20 issues = create_list(:issue, 3, :issue_type => "moderator")
23 assert page.has_content?(issues.first.reported_user.display_name)
26 def test_search_issues_by_user
27 good_user = create(:user)
28 bad_user = create(:user)
29 create(:issue, :reportable => bad_user, :reported_user => bad_user, :issue_type => "administrator")
31 sign_in_as(create(:administrator_user))
33 # No issues against the user
35 fill_in "search_by_user", :with => good_user.display_name
37 assert page.has_content?(I18n.t(".issues.index.search.issues_not_found"))
41 fill_in "search_by_user", :with => "Nonexistant User"
43 assert page.has_content?(I18n.t(".issues.index.search.user_not_found"))
45 # Find Issue against bad_user
47 fill_in "search_by_user", :with => bad_user.display_name
49 assert !page.has_content?(I18n.t(".issues.index.search.issues_not_found"))
53 issue = create(:issue)
54 sign_in_as(create(:moderator_user))
56 visit issue_path(issue)
58 fill_in :issue_comment_body, :with => "test comment"
60 assert page.has_content?(I18n.t(".issues.comment.comment_created"))
61 assert page.has_content?("test comment")
64 assert_equal issue.comments.first.body, "test comment"