compass/test/test_helper.rb

50 lines
1.3 KiB
Ruby
Raw Normal View History

need_gems = false
lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
$:.unshift(lib_dir) unless $:.include?(lib_dir)
test_dir = File.dirname(__FILE__)
$:.unshift(test_dir) unless $:.include?(test_dir)
# allows testing with edge Haml by creating a test/haml symlink
linked_haml = File.dirname(__FILE__) + '/haml'
if File.exists?(linked_haml) && !$:.include?(linked_haml + '/lib')
puts "[ using linked Haml ]"
$:.unshift linked_haml + '/lib'
require 'sass'
else
need_gems = true
end
require 'rubygems' if need_gems
require 'compass'
require 'test/unit'
2011-04-28 03:18:52 +00:00
%w(command_line diff io rails test_case).each do |helper|
require "helpers/#{helper}"
end
class Test::Unit::TestCase
include Compass::Diff
include Compass::TestCaseHelper
include Compass::IoHelper
extend Compass::TestCaseHelper::ClassMethods
2011-06-16 03:37:23 +00:00
end
module SpriteHelper
URI = "selectors/*.png"
2011-06-19 16:26:38 +00:00
def sprite_map_test(options)
2011-06-16 03:37:23 +00:00
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)
Compass::SassExtensions::Sprites::SpriteMap.new(sprite_names.map{|n| "selectors/#{n}.png"}, path, name, sass_engine, options)
end
end