Commit 3da73df79b708e5b575bd8c343b8eb84cf94bf20
Committed by
Daniela Feitosa
1 parent
1bcd568e
Exists in
master
and in
28 other branches
Fixing uploaded_file first_paragraph
(ActionItem1760)
Showing
2 changed files
with
16 additions
and
0 deletions
Show diff stats
app/models/uploaded_file.rb
@@ -30,6 +30,10 @@ class UploadedFile < Article | @@ -30,6 +30,10 @@ class UploadedFile < Article | ||
30 | title.blank? ? name : title | 30 | title.blank? ? name : title |
31 | end | 31 | end |
32 | 32 | ||
33 | + def first_paragraph | ||
34 | + '' | ||
35 | + end | ||
36 | + | ||
33 | def self.max_size | 37 | def self.max_size |
34 | UploadedFile.attachment_options[:max_size] | 38 | UploadedFile.attachment_options[:max_size] |
35 | end | 39 | end |
test/unit/uploaded_file_test.rb
@@ -275,4 +275,16 @@ class UploadedFileTest < Test::Unit::TestCase | @@ -275,4 +275,16 @@ class UploadedFileTest < Test::Unit::TestCase | ||
275 | assert_nil ActionTracker::Record.last(:conditions => { :verb => "upload_image" }) | 275 | assert_nil ActionTracker::Record.last(:conditions => { :verb => "upload_image" }) |
276 | end | 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 | end | 290 | end |