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
|
|
|
|
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-02-06 02:41:47 -08:00
|
|
|
test_name = caller[1].gsub(/^.*`(?:\w+ )*(\w+)'.*$/, '\1')
|
2008-12-25 14:17:12 -08:00
|
|
|
opts[:filename] = "#{test_name}_inline.sass"
|
|
|
|
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
|
2010-03-15 17:40:39 -07:00
|
|
|
|
|
|
|
if message.is_a?(Regexp)
|
|
|
|
assert_match message, $stderr.string.strip
|
|
|
|
else
|
|
|
|
assert_equal message.strip, $stderr.string.strip
|
|
|
|
end
|
2009-07-19 14:56:32 -07:00
|
|
|
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
|
2010-03-12 21:31:32 -08:00
|
|
|
|
|
|
|
def rails_block_helper_char
|
|
|
|
return '=' if Haml::Util.ap_geq_3?
|
|
|
|
return '-'
|
|
|
|
end
|
2008-12-25 14:17:12 -08:00
|
|
|
end
|