fixes #551 with failing test

This commit is contained in:
Scott Davis 2011-09-14 12:47:20 -04:00
parent 35b9b60c7c
commit e52184b6fe
3 changed files with 11 additions and 5 deletions

View File

@ -14,7 +14,7 @@ module Compass
# the path is relative to the <tt>images_path</tt> confguration option
def self.from_uri(uri, context, kwargs)
uri = uri.value
name, path = Compass::SpriteImporter.path_and_name(uri)
path, name = Compass::SpriteImporter.path_and_name(uri)
files = Compass::SpriteImporter.files(uri)
sprites = files.map do |sprite|
relative_name(sprite)

View File

@ -44,11 +44,11 @@ module SpriteHelper
@images_tmp_path = File.join(File.dirname(__FILE__), 'fixtures', 'sprites', 'public', 'images-tmp')
end
def sprite_map_test(options)
def sprite_map_test(options, uri = URI)
importer = Compass::SpriteImporter.new
path, name = Compass::SpriteImporter.path_and_name(URI)
sprite_names = Compass::SpriteImporter.sprite_names(URI)
sass_engine = Compass::SpriteImporter.sass_engine(URI, name, importer, options)
path, name = Compass::SpriteImporter.path_and_name(uri)
sprite_names = Compass::SpriteImporter.sprite_names(uri)
sass_engine = Compass::SpriteImporter.sass_engine(uri, name, importer, options)
Compass::SassExtensions::Sprites::SpriteMap.new(sprite_names.map{|n| "selectors/#{n}.png"}, path, name, sass_engine, options)
end

View File

@ -192,5 +192,11 @@ class SpriteMapTest < Test::Unit::TestCase
FileUtils.rm_rf other_folder
end
test "should create map for nested" do
base = Compass::SassExtensions::Sprites::SpriteMap.from_uri OpenStruct.new(:value => 'nested/squares/*.png'), @base.instance_variable_get(:@evaluation_context), @options
assert_equal 'squares', base.name
assert_equal 'nested/squares', base.path
end
end