closes #600 fixed to_path issue caused by sprokets

This commit is contained in:
Scott Davis 2011-11-17 15:07:03 -05:00
parent 3bc39aae2b
commit d33585581e
3 changed files with 12 additions and 2 deletions

View File

@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
compass (0.12.alpha.0.bc3334b) compass (0.12.alpha.1.3bc39aa)
chunky_png (~> 1.2) chunky_png (~> 1.2)
fssm (>= 0.2.7) fssm (>= 0.2.7)
sass (~> 3.1) sass (~> 3.1)

View File

@ -13,7 +13,7 @@ module Compass::SassExtensions::Functions::ImageSize
class ImageProperties class ImageProperties
def initialize(file) def initialize(file)
@file = file @file = (file.respond_to?(:to_path) ? file.to_path : file)
@file_type = File.extname(@file)[1..-1] @file_type = File.extname(@file)[1..-1]
end end

View File

@ -143,6 +143,16 @@ class SassExtensionsTest < Test::Unit::TestCase
assert_equal "url('data:font/truetype;base64,#{base64_string}') format('truetype')", evaluate("inline_font_files('bgrove.ttf', truetype)") assert_equal "url('data:font/truetype;base64,#{base64_string}') format('truetype')", evaluate("inline_font_files('bgrove.ttf', truetype)")
end 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 protected
def evaluate(value) def evaluate(value)
Sass::Script::Parser.parse(value, 0, 0).perform(Sass::Environment.new).to_s Sass::Script::Parser.parse(value, 0, 0).perform(Sass::Environment.new).to_s