Skip to content

Commit 6de8a85

Browse files
committed
added controller test for trying to rename comment threads to invalid titles
1 parent 295e8e6 commit 6de8a85

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

test/controllers/comments/rename_test.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class CommentsControllerTest < ActionController::TestCase
2323
before_title = comment_threads(name).title
2424

2525
try_rename_thread(comment_threads(name))
26-
2726
@thread = assigns(:comment_thread)
2827

2928
assert_response(:found)
@@ -32,4 +31,18 @@ class CommentsControllerTest < ActionController::TestCase
3231
assert_equal before_title, @thread.title
3332
end
3433
end
34+
35+
test 'should correctly handle invalid thread titles' do
36+
sign_in users(:admin)
37+
38+
['', 'a' * 512].each do |title|
39+
try_rename_thread(comment_threads(:normal), title: title)
40+
@thread = assigns(:comment_thread)
41+
42+
assert_response(:found)
43+
assert_not_nil @thread
44+
assert_not @thread.valid?
45+
assert_not_nil flash[:danger]
46+
end
47+
end
3548
end

0 commit comments

Comments
 (0)