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
This commit is contained in:
Eric Davis 2010-06-19 22:17:34 +00:00
parent b10818f4a1
commit 093853b56a
1 changed files with 18 additions and 0 deletions

View File

@ -47,6 +47,24 @@ class DocumentsControllerTest < ActionController::TestCase
:content => 'Technical documentation'} :content => 'Technical documentation'}
end end
def test_index_with_long_description
# adds a long description to the first document
doc = documents(:documents_001)
doc.update_attributes(:description => <<LOREM)
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut egestas, mi vehicula varius varius, ipsum massa fermentum orci, eget tristique ante sem vel mi. Nulla facilisi. Donec enim libero, luctus ac sagittis sit amet, vehicula sagittis magna. Duis ultrices molestie ante, eget scelerisque sem iaculis vitae. Etiam fermentum mauris vitae metus pharetra condimentum fermentum est pretium. Proin sollicitudin elementum quam quis pharetra. Aenean facilisis nunc quis elit volutpat mollis. Aenean eleifend varius euismod. Ut dolor est, congue eget dapibus eget, elementum eu odio. Integer et lectus neque, nec scelerisque nisi. EndOfLineHere
Vestibulum non velit mi. Aliquam scelerisque libero ut nulla fringilla a sollicitudin magna rhoncus. Praesent a nunc lorem, ac porttitor eros. Sed ac diam nec neque interdum adipiscing quis quis justo. Donec arcu nunc, fringilla eu dictum at, venenatis ac sem. Vestibulum quis elit urna, ac mattis sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
LOREM
get :index, :project_id => '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 def test_new_with_one_attachment
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
Setting.notified_events << 'document_added' Setting.notified_events << 'document_added'