Commit 8ef58efec7247a2e1b7728340e11d4044ace4123
1 parent
544969ab
Exists in
staging
and in
42 other branches
rails3: fix slideshow_block_test
Showing
2 changed files
with
5 additions
and
5 deletions
Show diff stats
app/models/slideshow_block.rb
| ... | ... | @@ -20,7 +20,7 @@ class SlideshowBlock < Block |
| 20 | 20 | |
| 21 | 21 | def check_filename(image, size) |
| 22 | 22 | filename = image.public_filename(size) |
| 23 | - if File.exists?(Rails.root.join('public', filename)) | |
| 23 | + if File.exists?(File.join(Rails.root.join('public').to_s, filename)) | |
| 24 | 24 | filename |
| 25 | 25 | else |
| 26 | 26 | nil | ... | ... |
test/unit/slideshow_block_test.rb
| ... | ... | @@ -75,7 +75,7 @@ class SlideshowBlockTest < ActiveSupport::TestCase |
| 75 | 75 | should 'decide correct public filename for image' do |
| 76 | 76 | image = mock |
| 77 | 77 | image.expects(:public_filename).with('slideshow').returns('/bli/slideshow.png') |
| 78 | - File.expects(:exists?).with(Rails.root.join('public', 'bli', 'slideshow.png')).returns(true) | |
| 78 | + File.expects(:exists?).with(Rails.root.join('public', 'bli', 'slideshow.png').to_s).returns(true) | |
| 79 | 79 | |
| 80 | 80 | assert_equal '/bli/slideshow.png', build(SlideshowBlock, :image_size => 'slideshow').public_filename_for(image) |
| 81 | 81 | end |
| ... | ... | @@ -83,7 +83,7 @@ class SlideshowBlockTest < ActiveSupport::TestCase |
| 83 | 83 | should 'display the default slideshow image if thumbnails were not processed' do |
| 84 | 84 | image = mock |
| 85 | 85 | image.expects(:public_filename).with('slideshow').returns('/images/icons-app/image-loading-slideshow.png') |
| 86 | - File.expects(:exists?).with(Rails.root.join('public', 'images', 'icons-app', 'image-loading-slideshow.png')).returns(true) | |
| 86 | + File.expects(:exists?).with(Rails.root.join('public', 'images', 'icons-app', 'image-loading-slideshow.png').to_s).returns(true) | |
| 87 | 87 | |
| 88 | 88 | assert_equal '/images/icons-app/image-loading-slideshow.png', build(SlideshowBlock, :image_size => 'slideshow').public_filename_for(image) |
| 89 | 89 | end |
| ... | ... | @@ -94,11 +94,11 @@ class SlideshowBlockTest < ActiveSupport::TestCase |
| 94 | 94 | image = mock |
| 95 | 95 | # "slideshow" size does not exist |
| 96 | 96 | image.expects(:public_filename).with('slideshow').returns('/bli/slideshow.png') |
| 97 | - File.expects(:exists?).with(Rails.root.join('public', 'bli', 'slideshow.png')).returns(false) # <<<<< | |
| 97 | + File.expects(:exists?).with(Rails.root.join('public', 'bli', 'slideshow.png').to_s).returns(false) # <<<<< | |
| 98 | 98 | |
| 99 | 99 | # thumb size does exist |
| 100 | 100 | image.expects(:public_filename).with('thumb').returns('/bli/thumb.png') |
| 101 | - File.expects(:exists?).with(Rails.root.join('public', 'bli', 'thumb.png')).returns(true) # <<<<< | |
| 101 | + File.expects(:exists?).with(Rails.root.join('public', 'bli', 'thumb.png').to_s).returns(true) # <<<<< | |
| 102 | 102 | |
| 103 | 103 | assert_equal '/bli/thumb.png', block.public_filename_for(image) |
| 104 | 104 | end | ... | ... |