Sha256: 0bc083a595c5e8b6cef348c0beed6b39a4bbc64a9f7e3cc7d07d40a5224e1986

Contents?: true

Size: 1.43 KB

Versions: 33

Compression:

Stored size: 1.43 KB

Contents

lib_dir = File.dirname(__FILE__) + '/../lib'
require File.dirname(__FILE__) + '/linked_rails'

require 'test/unit'
require 'fileutils'
$:.unshift lib_dir unless $:.include?(lib_dir)
require 'haml'
require 'sass'

Sass::RAILS_LOADED = true unless defined?(Sass::RAILS_LOADED)

module Sass::Script::Functions
  module UserFunctions; end
  include UserFunctions

  def option(name)
    Sass::Script::String.new(@options[name.value.to_sym].to_s)
  end
end

class Test::Unit::TestCase
  def munge_filename(opts = {})
    return if opts.has_key?(:filename)
    opts[:filename] = filename_for_test(opts[:syntax] || :sass)
  end

  def filename_for_test(syntax = :sass)
    test_name = caller.
      map {|c| Haml::Util.caller_info(c)[2]}.
      compact.
      map {|c| c.sub(/^(block|rescue) in /, '')}.
      find {|c| c =~ /^test_/}
    "#{test_name}_inline.#{syntax}"
  end

  def clean_up_sassc
    path = File.dirname(__FILE__) + "/../.sass-cache"
    FileUtils.rm_r(path) if File.exist?(path)
  end

  def assert_warning(message)
    the_real_stderr, $stderr = $stderr, StringIO.new
    yield

    if message.is_a?(Regexp)
      assert_match message, $stderr.string.strip
    else
      assert_equal message.strip, $stderr.string.strip
    end
  ensure
    $stderr = the_real_stderr
  end

  def silence_warnings(&block)
    Haml::Util.silence_warnings(&block)
  end

  def rails_block_helper_char
    return '=' if Haml::Util.ap_geq_3?
    return '-'
  end
end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
haml-edge-2.3.209 test/test_helper.rb
haml-3.0.0.beta.3 test/test_helper.rb
haml-edge-2.3.208 test/test_helper.rb
haml-edge-2.3.207 test/test_helper.rb
haml-edge-2.3.206 test/test_helper.rb
haml-edge-2.3.205 test/test_helper.rb
haml-edge-2.3.204 test/test_helper.rb
haml-3.0.0.beta.2 test/test_helper.rb
haml-edge-2.3.203 test/test_helper.rb
haml-edge-2.3.202 test/test_helper.rb
haml-edge-2.3.201 test/test_helper.rb
haml-edge-2.3.200 test/test_helper.rb
haml-edge-2.3.199 test/test_helper.rb
haml-edge-2.3.198 test/test_helper.rb
haml-edge-2.3.197 test/test_helper.rb
haml-edge-2.3.196 test/test_helper.rb
haml-edge-2.3.195 test/test_helper.rb
haml-edge-2.3.194 test/test_helper.rb
haml-edge-2.3.193 test/test_helper.rb
haml-edge-2.3.192 test/test_helper.rb