From 093853b56a5e988d1087dbcb5d3b28bfe153c8a5 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Sat, 19 Jun 2010 22:17:34 +0000 Subject: [PATCH] Added tests for #5533's behavior. Contributed by Gregor Schmidt. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3788 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/documents_controller_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/functional/documents_controller_test.rb b/test/functional/documents_controller_test.rb index 65afc229c..a1ce7ea77 100644 --- a/test/functional/documents_controller_test.rb +++ b/test/functional/documents_controller_test.rb @@ -47,6 +47,24 @@ class DocumentsControllerTest < ActionController::TestCase :content => 'Technical documentation'} end + def test_index_with_long_description + # adds a long description to the first document + doc = documents(:documents_001) + doc.update_attributes(:description => < 'ecookbook' + assert_response :success + assert_template 'index' + + # should only truncate on new lines to avoid breaking wiki formatting + assert_select '.wiki p', :text => (doc.description.split("\n").first + '...') + assert_select '.wiki p', :text => Regexp.new(Regexp.escape("EndOfLineHere...")) + end + def test_new_with_one_attachment ActionMailer::Base.deliveries.clear Setting.notified_events << 'document_added'