Sha256: c0388e4ec9ad13af7a754ac9ca4f2ace0e52d55a31fc81397ce0dc31be2b9c39

Contents?: true

Size: 1008 Bytes

Versions: 16

Compression:

Stored size: 1008 Bytes

Contents

module Compass
  # Write your unit test like this if you want to make sure all your stylesheets compile.
  #
  # require 'compass/test_case'
  # class StylesheetsTest < Compass::TestCase
  #   def test_stylesheets
  #     my_sass_files.each do |sass_file|
  #       assert_compiles(sass_file) do |result|
  #         assert_not_blank result
  #       end
  #     end
  #   end
  #   protected
  #   def my_sass_files
  #     Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), "../..", "app/stylesheets/**/[^_]*.sass")))
  #   end
  # end
  class TestCase < Test::Unit::TestCase
    def setup
      @last_compile = nil
    end

    def compile(stylesheet)
      input =  open(stylesheet)
      template = input.read()
      input.close()
      @last_compile = ::Sass::Engine.new(template, ::Sass::Plugin.engine_options(:filename => stylesheet)).render
      yield @last_compile if block_given?
    end

    def assert_compiles(stylesheet, &block)
      compile(stylesheet, &block)
    end

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
chriseppstein-compass-0.6.10 lib/compass/test_case.rb
chriseppstein-compass-0.6.11 lib/compass/test_case.rb
chriseppstein-compass-0.6.12 lib/compass/test_case.rb
chriseppstein-compass-0.6.13 lib/compass/test_case.rb
chriseppstein-compass-0.6.14 lib/compass/test_case.rb
chriseppstein-compass-0.6.15 lib/compass/test_case.rb
chriseppstein-compass-0.6.6 lib/compass/test_case.rb
chriseppstein-compass-0.6.7 lib/compass/test_case.rb
chriseppstein-compass-0.6.8 lib/compass/test_case.rb
chriseppstein-compass-0.6.9 lib/compass/test_case.rb
chriseppstein-compass-0.7.0 lib/compass/test_case.rb
chriseppstein-compass-0.8.0 lib/compass/test_case.rb
chriseppstein-compass-0.8.1 lib/compass/test_case.rb
chriseppstein-compass-0.8.2 lib/compass/test_case.rb
chriseppstein-compass-0.8.3 lib/compass/test_case.rb
chriseppstein-compass-0.8.4 lib/compass/test_case.rb