Commit 3da73df79b708e5b575bd8c343b8eb84cf94bf20

Authored by Rodrigo Souto
Committed by Daniela Feitosa
1 parent 1bcd568e

Fixing uploaded_file first_paragraph

(ActionItem1760)
app/models/uploaded_file.rb
... ... @@ -30,6 +30,10 @@ class UploadedFile < Article
30 30 title.blank? ? name : title
31 31 end
32 32  
  33 + def first_paragraph
  34 + ''
  35 + end
  36 +
33 37 def self.max_size
34 38 UploadedFile.attachment_options[:max_size]
35 39 end
... ...
test/unit/uploaded_file_test.rb
... ... @@ -275,4 +275,16 @@ class UploadedFileTest < Test::Unit::TestCase
275 275 assert_nil ActionTracker::Record.last(:conditions => { :verb => "upload_image" })
276 276 end
277 277  
  278 + should 'not crash if first paragraph called' do
  279 + f = fast_create(UploadedFile)
  280 + assert_nothing_raised do
  281 + f.first_paragraph
  282 + end
  283 + end
  284 +
  285 + should 'return empty string to lead if no abstract given' do
  286 + f = fast_create(UploadedFile, :abstract => nil)
  287 + assert_equal '', f.lead
  288 + end
  289 +
278 290 end
... ...