diff --git a/Gemfile.lock b/Gemfile.lock index 6a3cdb66..81dad8e4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - compass (0.12.alpha.0.bc3334b) + compass (0.12.alpha.1.3bc39aa) chunky_png (~> 1.2) fssm (>= 0.2.7) sass (~> 3.1) diff --git a/lib/compass/sass_extensions/functions/image_size.rb b/lib/compass/sass_extensions/functions/image_size.rb index 2a804930..63f4850f 100644 --- a/lib/compass/sass_extensions/functions/image_size.rb +++ b/lib/compass/sass_extensions/functions/image_size.rb @@ -13,7 +13,7 @@ module Compass::SassExtensions::Functions::ImageSize class ImageProperties def initialize(file) - @file = file + @file = (file.respond_to?(:to_path) ? file.to_path : file) @file_type = File.extname(@file)[1..-1] end diff --git a/test/units/sass_extensions_test.rb b/test/units/sass_extensions_test.rb index 929bb7fe..5db28691 100644 --- a/test/units/sass_extensions_test.rb +++ b/test/units/sass_extensions_test.rb @@ -142,6 +142,16 @@ class SassExtensionsTest < Test::Unit::TestCase base64_string = File.read(File.join(Compass.configuration.fonts_path, "bgrove.base64.txt")).chomp assert_equal "url('data:font/truetype;base64,#{base64_string}') format('truetype')", evaluate("inline_font_files('bgrove.ttf', truetype)") end + + + def test_image_size_should_respond_to_to_path + object = mock() + object.expects(:to_path).returns('foo.jpg') + object.expects(:respond_to?).with(:to_path).returns(true) + + Compass::SassExtensions::Functions::ImageSize::ImageProperties.new(object) + end + protected def evaluate(value)