]> git.openstreetmap.org Git - rails.git/blob - test/features/issues_test.rb
Merge branch 'master' into moderation
[rails.git] / test / features / issues_test.rb
1 require "test_helper"
2
3 class IssuesTest < Capybara::Rails::TestCase
4   def test_view_issues_normal_user
5     sign_in_as(create(:user))
6
7     visit issues_path
8     assert page.has_content?(I18n.t("application.require_admin.not_an_admin"))
9   end
10
11   def test_view_no_issues
12     sign_in_as(create(:moderator_user))
13
14     visit issues_path
15     assert page.has_content?(I18n.t(".issues.index.search.issues_not_found"))
16   end
17
18   def test_view_issues
19     sign_in_as(create(:moderator_user))
20     issues = create_list(:issue, 3, :issue_type => "moderator")
21
22     visit issues_path
23     assert page.has_content?(issues.first.reported_user.display_name)
24   end
25
26   def test_commenting
27     issue = create(:issue)
28     sign_in_as(create(:moderator_user))
29
30     visit issue_path(issue)
31
32     fill_in :issue_comment_body, :with => "test comment"
33     click_on "Submit"
34     assert page.has_content?(I18n.t(".issues.comment.comment_created"))
35     assert page.has_content?("test comment")
36
37     issue.reload
38     assert_equal issue.comments.first.body, "test comment"
39   end
40 end