Commit 8ef58efec7247a2e1b7728340e11d4044ace4123
1 parent
544969ab
Exists in
master
and in
27 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,7 +20,7 @@ class SlideshowBlock < Block | ||
20 | 20 | ||
21 | def check_filename(image, size) | 21 | def check_filename(image, size) |
22 | filename = image.public_filename(size) | 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 | filename | 24 | filename |
25 | else | 25 | else |
26 | nil | 26 | nil |
test/unit/slideshow_block_test.rb
@@ -75,7 +75,7 @@ class SlideshowBlockTest < ActiveSupport::TestCase | @@ -75,7 +75,7 @@ class SlideshowBlockTest < ActiveSupport::TestCase | ||
75 | should 'decide correct public filename for image' do | 75 | should 'decide correct public filename for image' do |
76 | image = mock | 76 | image = mock |
77 | image.expects(:public_filename).with('slideshow').returns('/bli/slideshow.png') | 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 | assert_equal '/bli/slideshow.png', build(SlideshowBlock, :image_size => 'slideshow').public_filename_for(image) | 80 | assert_equal '/bli/slideshow.png', build(SlideshowBlock, :image_size => 'slideshow').public_filename_for(image) |
81 | end | 81 | end |
@@ -83,7 +83,7 @@ class SlideshowBlockTest < ActiveSupport::TestCase | @@ -83,7 +83,7 @@ class SlideshowBlockTest < ActiveSupport::TestCase | ||
83 | should 'display the default slideshow image if thumbnails were not processed' do | 83 | should 'display the default slideshow image if thumbnails were not processed' do |
84 | image = mock | 84 | image = mock |
85 | image.expects(:public_filename).with('slideshow').returns('/images/icons-app/image-loading-slideshow.png') | 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 | assert_equal '/images/icons-app/image-loading-slideshow.png', build(SlideshowBlock, :image_size => 'slideshow').public_filename_for(image) | 88 | assert_equal '/images/icons-app/image-loading-slideshow.png', build(SlideshowBlock, :image_size => 'slideshow').public_filename_for(image) |
89 | end | 89 | end |
@@ -94,11 +94,11 @@ class SlideshowBlockTest < ActiveSupport::TestCase | @@ -94,11 +94,11 @@ class SlideshowBlockTest < ActiveSupport::TestCase | ||
94 | image = mock | 94 | image = mock |
95 | # "slideshow" size does not exist | 95 | # "slideshow" size does not exist |
96 | image.expects(:public_filename).with('slideshow').returns('/bli/slideshow.png') | 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 | # thumb size does exist | 99 | # thumb size does exist |
100 | image.expects(:public_filename).with('thumb').returns('/bli/thumb.png') | 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 | assert_equal '/bli/thumb.png', block.public_filename_for(image) | 103 | assert_equal '/bli/thumb.png', block.public_filename_for(image) |
104 | end | 104 | end |