Commit c052ed1e13fc0de68b9372b5747ce9bb1696adae
1 parent
ebb43808
Exists in
master
and in
29 other branches
rails3: fix tests related to upload_file
Showing
4 changed files
with
6 additions
and
6 deletions
Show diff stats
app/models/uploaded_file.rb
@@ -33,7 +33,7 @@ class UploadedFile < Article | @@ -33,7 +33,7 @@ class UploadedFile < Article | ||
33 | end | 33 | end |
34 | 34 | ||
35 | def thumbnail_path | 35 | def thumbnail_path |
36 | - self.image? ? self.full_filename(:display).to_s.gsub(Rails.root.join('public'), '') : nil | 36 | + self.image? ? self.full_filename(:display).to_s.gsub(Rails.root.join('public').to_s, '') : nil |
37 | end | 37 | end |
38 | 38 | ||
39 | def display_title | 39 | def display_title |
test/unit/uploaded_file_test.rb
@@ -101,7 +101,7 @@ class UploadedFileTest < ActiveSupport::TestCase | @@ -101,7 +101,7 @@ class UploadedFileTest < ActiveSupport::TestCase | ||
101 | up = build(UploadedFile, :filename => 'fake_filename.png') | 101 | up = build(UploadedFile, :filename => 'fake_filename.png') |
102 | up.valid? | 102 | up.valid? |
103 | 103 | ||
104 | - assert_match /#{UploadedFile.max_size.to_humanreadable}/, up.errors[:size] | 104 | + assert_match /#{UploadedFile.max_size.to_humanreadable}/, up.errors[:size].first |
105 | end | 105 | end |
106 | 106 | ||
107 | should 'display link to download of non-image files' do | 107 | should 'display link to download of non-image files' do |
@@ -128,8 +128,7 @@ class UploadedFileTest < ActiveSupport::TestCase | @@ -128,8 +128,7 @@ class UploadedFileTest < ActiveSupport::TestCase | ||
128 | assert upload.errors[:title] | 128 | assert upload.errors[:title] |
129 | 129 | ||
130 | upload.title = '+' * 60; upload.valid? | 130 | upload.title = '+' * 60; upload.valid? |
131 | - assert !upload.errors[:title] | ||
132 | - | 131 | + assert_blank upload.errors[:title] |
133 | end | 132 | end |
134 | 133 | ||
135 | should 'always provide a display title' do | 134 | should 'always provide a display title' do |
@@ -151,7 +150,7 @@ class UploadedFileTest < ActiveSupport::TestCase | @@ -151,7 +150,7 @@ class UploadedFileTest < ActiveSupport::TestCase | ||
151 | should 'use name as title by default but cut down the title' do | 150 | should 'use name as title by default but cut down the title' do |
152 | upload = build(UploadedFile, :uploaded_data => fixture_file_upload('/files/AGENDA_CULTURA_-_FESTA_DE_VAQUEIROS_PONTO_DE_SERRA_PRETA_BAIXA.txt')) | 151 | upload = build(UploadedFile, :uploaded_data => fixture_file_upload('/files/AGENDA_CULTURA_-_FESTA_DE_VAQUEIROS_PONTO_DE_SERRA_PRETA_BAIXA.txt')) |
153 | upload.valid? | 152 | upload.valid? |
154 | - assert_nil upload.errors[:title] | 153 | + assert_blank upload.errors[:title] |
155 | end | 154 | end |
156 | 155 | ||
157 | should 'create thumbnails after processing jobs' do | 156 | should 'create thumbnails after processing jobs' do |
vendor/plugins/monkey_patches/attachment_fu/init.rb
1 | # Monkey patch to rewrite attachment_fu's logic where no image with parent can | 1 | # Monkey patch to rewrite attachment_fu's logic where no image with parent can |
2 | # be thumbnailable. | 2 | # be thumbnailable. |
3 | 3 | ||
4 | -Technoweenie::AttachmentFu.module_eval do | 4 | +Technoweenie::AttachmentFu::InstanceMethods.module_eval do |
5 | def thumbnailable? | 5 | def thumbnailable? |
6 | image? && !is_thumbnail? | 6 | image? && !is_thumbnail? |
7 | end | 7 | end |
vendor/plugins/monkey_patches/init.rb