diff --git a/app/models/uploaded_file.rb b/app/models/uploaded_file.rb index 029929b..ab419bc 100644 --- a/app/models/uploaded_file.rb +++ b/app/models/uploaded_file.rb @@ -30,6 +30,10 @@ class UploadedFile < Article title.blank? ? name : title end + def first_paragraph + '' + end + def self.max_size UploadedFile.attachment_options[:max_size] end diff --git a/test/unit/uploaded_file_test.rb b/test/unit/uploaded_file_test.rb index c501d5f..19e11b1 100644 --- a/test/unit/uploaded_file_test.rb +++ b/test/unit/uploaded_file_test.rb @@ -275,4 +275,16 @@ class UploadedFileTest < Test::Unit::TestCase assert_nil ActionTracker::Record.last(:conditions => { :verb => "upload_image" }) end + should 'not crash if first paragraph called' do + f = fast_create(UploadedFile) + assert_nothing_raised do + f.first_paragraph + end + end + + should 'return empty string to lead if no abstract given' do + f = fast_create(UploadedFile, :abstract => nil) + assert_equal '', f.lead + end + end -- libgit2 0.21.2