1 require "application_system_test_case"
3 class NoteCommentsTest < ApplicationSystemTestCase
4 test "open note has login notice" do
5 note = create(:note_with_comments)
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))
15 test "closed note has no login notice" do
16 note = create(:note_with_comments, :closed)
20 assert_no_button "Reactivate"
21 assert_no_link "Log in to comment on this note"
26 note = create(:note_with_comments)
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
37 fill_in "text", :with => "Some newly added note comment"
39 assert_button "Comment & Resolve"
40 assert_button "Comment", :disabled => false
44 assert_content "Comment from #{user.display_name}"
45 assert_content "Some newly added note comment"
49 test "can't add a comment when blocked" do
50 note = create(:note_with_comments)
54 block = create(:user_block, :user => user)
57 fill_in "text", :with => "Comment that won't be added while blocked"
59 assert_no_text "Comment from #{user.display_name}"
60 assert_no_text "Comment that won't be added while blocked"
61 assert_no_text "Your access to the API has been blocked"
62 assert_button "Comment & Resolve", :disabled => false
63 assert_button "Comment", :disabled => false
67 assert_no_text "Comment from #{user.display_name}"
68 assert_no_text "Comment that won't be added while blocked"
69 assert_text "Your access to the API has been blocked"
70 assert_button "Comment & Resolve", :disabled => false
71 assert_button "Comment", :disabled => false
73 block.revoke! block.creator
77 assert_text "Comment from #{user.display_name}"
78 assert_text "Comment that won't be added while blocked"
79 assert_no_text "Your access to the API has been blocked"
83 test "can't resolve a note when blocked" do
84 note = create(:note_with_comments)
88 create(:user_block, :user => user)
91 assert_text "Unresolved note"
92 assert_no_text "Resolved note"
93 assert_no_text "Your access to the API has been blocked"
94 assert_button "Resolve", :disabled => false
95 assert_button "Comment", :disabled => true
99 assert_text "Unresolved note"
100 assert_no_text "Resolved note"
101 assert_text "Your access to the API has been blocked"
102 assert_button "Resolve", :disabled => false
103 assert_button "Comment", :disabled => true
107 test "can't reactivate a note when blocked" do
108 note = create(:note_with_comments, :closed)
111 visit note_path(note)
112 create(:user_block, :user => user)
115 assert_no_text "Unresolved note"
116 assert_text "Resolved note"
117 assert_no_text "Your access to the API has been blocked"
118 assert_button "Reactivate", :disabled => false
120 click_on "Reactivate"
122 assert_no_text "Unresolved note"
123 assert_text "Resolved note"
124 assert_text "Your access to the API has been blocked"
125 assert_button "Reactivate", :disabled => false