Sha256: 3b14916c77e10a0bc5ce2cd66f163e5b9008c5e1ef55321126f80164d70ccdd0

Contents?: true

Size: 1.01 KB

Versions: 33

Compression:

Stored size: 1.01 KB

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(:style => :compact, :filename => stylesheet)).render
      yield @last_compile if block_given?
    end

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

  end
end

Version data entries

33 entries across 33 versions & 6 rubygems

Version Path
arnebrasseur-compass-0.3.5.1 lib/compass/test_case.rb
arnebrasseur-compass-0.3.5 lib/compass/test_case.rb
bsherman-compass-0.5.2 lib/compass/test_case.rb
chriseppstein-compass-0.1.1 lib/compass/test_case.rb
chriseppstein-compass-0.3.0 lib/compass/test_case.rb
chriseppstein-compass-0.3.1 lib/compass/test_case.rb
chriseppstein-compass-0.3.2 lib/compass/test_case.rb
chriseppstein-compass-0.3.3 lib/compass/test_case.rb
chriseppstein-compass-0.3.4 lib/compass/test_case.rb
chriseppstein-compass-0.3.6 lib/compass/test_case.rb
chriseppstein-compass-0.3.7 lib/compass/test_case.rb
chriseppstein-compass-0.3.8 lib/compass/test_case.rb
chriseppstein-compass-0.3.9 lib/compass/test_case.rb
chriseppstein-compass-0.4.0 lib/compass/test_case.rb
chriseppstein-compass-0.4.1 lib/compass/test_case.rb
chriseppstein-compass-0.4.2 lib/compass/test_case.rb
chriseppstein-compass-0.5.0 lib/compass/test_case.rb
chriseppstein-compass-0.5.1 lib/compass/test_case.rb
chriseppstein-compass-0.5.2 lib/compass/test_case.rb
chriseppstein-compass-0.5.3 lib/compass/test_case.rb