]> git.openstreetmap.org Git - rails.git/blob - test/system/note_comments_test.rb
Fix new rubocop warnings
[rails.git] / test / system / note_comments_test.rb
1 require "application_system_test_case"
2
3 class NoteCommentsTest < ApplicationSystemTestCase
4   test "open note has login notice" do
5     note = create(:note_with_comments)
6     visit note_path(note)
7
8     assert_no_button "Resolve"
9     assert_no_button "Comment"
10     assert_link "Log in to comment on this note", :href => login_path(:referer => note_path(note))
11   end
12
13   test "closed note has no login notice" do
14     note = create(:note_with_comments, :closed)
15     visit note_path(note)
16
17     assert_no_button "Reactivate"
18     assert_no_link "Log in to comment on this note"
19   end
20
21   def test_add_comment
22     note = create(:note_with_comments)
23     user = create(:user)
24     sign_in_as(user)
25     visit note_path(note)
26
27     assert_no_content "Comment from #{user.display_name}"
28     assert_no_content "Some newly added note comment"
29     assert_button "Resolve"
30     assert_button "Comment", :disabled => true
31
32     fill_in "text", :with => "Some newly added note comment"
33
34     assert_button "Comment & Resolve"
35     assert_button "Comment", :disabled => false
36
37     click_on "Comment"
38
39     assert_content "Comment from #{user.display_name}"
40     assert_content "Some newly added note comment"
41   end
42 end