From d33585581e954da2e4b06d15bf942ae73f9756fc Mon Sep 17 00:00:00 2001
From: Scott Davis <jetviper21@gmail.com>
Date: Thu, 17 Nov 2011 15:07:03 -0500
Subject: [PATCH] closes #600 fixed to_path issue caused by sprokets

---
 Gemfile.lock                                        |  2 +-
 lib/compass/sass_extensions/functions/image_size.rb |  2 +-
 test/units/sass_extensions_test.rb                  | 10 ++++++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

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)