diff --git a/Gemfile.lock b/Gemfile.lock index fd728c5c..33b44d66 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ GIT PATH remote: . specs: - compass (0.11.1.f4f9d7b) + compass (0.11.1.8e2292b) chunky_png (~> 1.1) fssm (>= 0.2.7) sass (~> 3.1) diff --git a/lib/compass/sass_extensions/sprites/base.rb b/lib/compass/sass_extensions/sprites/base.rb index aa671b39..194a5601 100644 --- a/lib/compass/sass_extensions/sprites/base.rb +++ b/lib/compass/sass_extensions/sprites/base.rb @@ -12,7 +12,7 @@ module Compass sprites = sprite_map.files.map do |sprite| sprite.gsub(Compass.configuration.images_path+"/", "") end - new(sprites, sprite_map.path, sprite_map.name, context, kwargs) + new(sprites, sprite_map, context, kwargs) end # Loads the sprite engine @@ -24,17 +24,18 @@ module Compass # We should do so only when the packing algorithm changes SPRITE_VERSION = "1" - attr_accessor :image_names, :path, :name, :options + attr_accessor :image_names, :path, :name, :options, :map attr_accessor :images, :width, :height - def initialize(image_names, path, name, context, options) + def initialize(image_names, map, context, options) require_engine! - @image_names, @path, @name, @options = image_names, path, name, options + @image_names, @path, @name, @options = image_names, map.path, map.name, options @images = nil @width = nil @height = nil @evaluation_context = context + @map = map validate! compute_image_metadata! end diff --git a/test/helpers/test_case.rb b/test/helpers/test_case.rb index 530ba59e..08922e02 100644 --- a/test/helpers/test_case.rb +++ b/test/helpers/test_case.rb @@ -20,6 +20,10 @@ module Compass module ClassMethods + def let(method, &block) + define_method method, &block + end + def it(name, &block) test(name, &block) end diff --git a/test/sprites/base_test.rb b/test/sprites/base_test.rb index 7205b027..a5c0adef 100644 --- a/test/sprites/base_test.rb +++ b/test/sprites/base_test.rb @@ -12,7 +12,7 @@ class SpritesBaseTest < Test::Unit::TestCase Compass.configure_sass_plugin! options = Compass.sass_engine_options.extend Compass::SassExtensions::Functions::Sprites::VariableReader @map = Compass::SpriteMap.new("selectors/*.png", options) - @base = Compass::SassExtensions::Sprites::Base.new(@map.sprite_names.map{|n| "selectors/#{n}.png"}, @map.path, 'selectors', @map.sass_engine, @map.options) + @base = Compass::SassExtensions::Sprites::Base.new(@map.sprite_names.map{|n| "selectors/#{n}.png"}, @map, @map.sass_engine, @map.options) end def teardown