]> git.openstreetmap.org Git - rails.git/blob - test/system/note_comments_test.rb
ea19dcd9497fc3f6d17bb206693580114db685d2
[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     within_sidebar do
9       assert_no_button "Resolve"
10       assert_no_button "Comment"
11       assert_link "Log in to comment on this note", :href => login_path(:referer => note_path(note))
12     end
13   end
14
15   test "closed note has no login notice" do
16     note = create(:note_with_comments, :closed)
17     visit note_path(note)
18
19     within_sidebar do
20       assert_no_button "Reactivate"
21       assert_no_link "Log in to comment on this note"
22     end
23   end
24
25   def test_add_comment
26     note = create(:note_with_comments)
27     user = create(:user)
28     sign_in_as(user)
29     visit note_path(note)
30
31     within_sidebar do
32       assert_no_content "Comment from #{user.display_name}"
33       assert_no_content "Some newly added note comment"
34       assert_button "Resolve"
35       assert_button "Comment", :disabled => true
36
37       fill_in "text", :with => "Some newly added note comment"
38
39       assert_button "Comment & Resolve"
40       assert_button "Comment", :disabled => false
41
42       click_on "Comment"
43
44       assert_content "Comment from #{user.display_name}"
45       assert_content "Some newly added note comment"
46     end
47   end
48 end