Sha256: c95daf3f399b95abe873ad9620cf5c5aa9780dc2acb5063cc507d0e613d2ae48

Contents?: true

Size: 633 Bytes

Versions: 2

Compression:

Stored size: 633 Bytes

Contents

require 'test_helper'

class CliTest < Test::Unit::TestCase
  COMMAND = "ruby -rubygems -Ilib bin/deadweight -s test/fixtures/style.css test/fixtures/index.html 2>/dev/null"

  should "output unused selectors on STDOUT" do
    @result = `#{COMMAND}`.split("\n")

    assert_equal 1, @result.grep(/^#foo \.bar \.baz \{/).length
    assert_equal 0, @result.grep(/^#foo \{/).length
    assert_equal 0, @result.grep(/^#foo .bar \{/).length
  end

  should "accept CSS rules on STDIN" do
    @result = `echo ".something { display: block; }" | #{COMMAND}`.split("\n")

    assert_equal 1, @result.grep(/^\.something \{/).length
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
aanand-deadweight-0.1.0 test/cli_test.rb
deadweight-0.1.0 test/cli_test.rb