Sha256: 2a944368820f2c61d5aabc22b6344d7a1db05547f1008b8d5ce3523980d23332

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

require 'test/unit'
require 'compass'
require 'compass-h5bp'
require 'sass/plugin'
require 'fileutils'

PROJECT_DIR = File.join(File.dirname(__FILE__), 'project')
ORIGINAL_OUTPUT_PATH = File.join(PROJECT_DIR, 'css', 'original.css')
TEST_OUTPUT_PATH = File.join(PROJECT_DIR, 'css', 'test.css')

class CompassH5bpTest < Test::Unit::TestCase
  
  def test_compass_version_matches_original
    FileUtils.rm_f ORIGINAL_OUTPUT_PATH
    FileUtils.rm_f TEST_OUTPUT_PATH
    Compass.reset_configuration!
    Compass.configuration do |config|
      config.environment = :production
      config.project_path = PROJECT_DIR
      config.sass_dir = 'sass'
      config.css_dir = 'css'
      config.cache = false
      config.output_style = :compact
      config.line_comments = false
    end
    args = Compass.configuration.to_compiler_arguments(:logger => Compass::NullLogger.new)
    compiler = Compass::Compiler.new *args
    compiler.run
    original_css = read_and_normalize(ORIGINAL_OUTPUT_PATH)
    test_css = read_and_normalize(TEST_OUTPUT_PATH)
    assert_equal original_css, test_css
  end
  
  def read_and_normalize(file)
    File.open(file).read.
      gsub(/\/\*.+?\*\/\n/m, '').
      gsub(/\n+/, "\n").
      gsub(/\n +/, "\n").
      gsub(/color: white;/, 'color: #ffffff;').
      gsub(/#(.)(.)(.)\b/, '#\1\1\2\2\3\3')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
compass-h5bp-0.1.0 test/compass_h5bp_test.rb
compass-h5bp-0.0.5 test/compass_h5bp_test.rb