2008-08-30 02:40:59 +02:00
|
|
|
lib_dir = File.dirname(__FILE__) + '/../lib'
|
2008-10-27 10:19:52 -07:00
|
|
|
require File.dirname(__FILE__) + '/linked_rails'
|
2008-03-05 22:03:07 +01:00
|
|
|
|
|
|
|
require 'test/unit'
|
2009-04-21 23:27:55 -07:00
|
|
|
require 'fileutils'
|
2008-08-30 02:40:59 +02:00
|
|
|
$:.unshift lib_dir unless $:.include?(lib_dir)
|
|
|
|
require 'haml'
|
|
|
|
require 'sass'
|
2008-09-22 00:24:18 +02:00
|
|
|
|
2009-07-12 12:17:37 -04:00
|
|
|
Sass::RAILS_LOADED = true unless defined?(Sass::RAILS_LOADED)
|
2009-07-11 12:21:18 -04:00
|
|
|
|
2009-11-21 10:07:59 -08:00
|
|
|
module Sass::Script::Functions
|
2009-12-03 12:28:13 -08:00
|
|
|
module UserFunctions; end
|
|
|
|
include UserFunctions
|
2010-01-20 20:30:14 -08:00
|
|
|
|
|
|
|
def option(name)
|
|
|
|
Sass::Script::String.new(@options[name.value.to_sym].to_s)
|
|
|
|
end
|
2009-11-21 10:07:59 -08:00
|
|
|
end
|
|
|
|
|
2008-12-25 14:17:12 -08:00
|
|
|
class Test::Unit::TestCase
|
|
|
|
def munge_filename(opts)
|
2009-12-28 01:54:09 -08:00
|
|
|
return if opts.has_key?(:filename)
|
2009-12-28 00:41:20 -08:00
|
|
|
opts[:filename] = filename_for_test
|
2009-11-24 20:31:15 -08:00
|
|
|
end
|
|
|
|
|
2009-12-28 00:41:20 -08:00
|
|
|
def filename_for_test
|
|
|
|
test_name = caller.
|
|
|
|
map {|c| Haml::Util.caller_info(c)[2]}.
|
|
|
|
compact.
|
|
|
|
map {|c| c.sub(/^(block|rescue) in /, '')}.
|
|
|
|
find {|c| c =~ /^test_/}
|
2009-11-24 20:31:15 -08:00
|
|
|
"#{test_name}_inline.sass"
|
2008-12-25 14:17:12 -08:00
|
|
|
end
|
2009-04-15 19:35:13 -07:00
|
|
|
|
|
|
|
def clean_up_sassc
|
2009-04-21 23:27:55 -07:00
|
|
|
path = File.dirname(__FILE__) + "/../.sass-cache"
|
|
|
|
FileUtils.rm_r(path) if File.exist?(path)
|
2009-04-15 19:35:13 -07:00
|
|
|
end
|
2009-07-19 14:56:32 -07:00
|
|
|
|
|
|
|
def assert_warning(message)
|
|
|
|
the_real_stderr, $stderr = $stderr, StringIO.new
|
|
|
|
yield
|
|
|
|
assert_equal message.strip, $stderr.string.strip
|
|
|
|
ensure
|
|
|
|
$stderr = the_real_stderr
|
|
|
|
end
|
|
|
|
|
2009-11-11 14:30:11 -08:00
|
|
|
def silence_warnings(&block)
|
|
|
|
Haml::Util.silence_warnings(&block)
|
2009-07-19 14:56:32 -07:00
|
|
|
end
|
2008-12-25 14:17:12 -08:00
|
|
|
end
|