test/cli_test.rb in deadweight-0.1.0 vs test/cli_test.rb in deadweight-0.1.1
- old
+ new
@@ -2,19 +2,17 @@
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")
+ @result = `#{COMMAND}`
- assert_equal 1, @result.grep(/^#foo \.bar \.baz \{/).length
- assert_equal 0, @result.grep(/^#foo \{/).length
- assert_equal 0, @result.grep(/^#foo .bar \{/).length
+ assert_correct_selectors_in_output(@result)
end
should "accept CSS rules on STDIN" do
- @result = `echo ".something { display: block; }" | #{COMMAND}`.split("\n")
+ @result = `echo ".something { display: block; }" | #{COMMAND}`
- assert_equal 1, @result.grep(/^\.something \{/).length
+ assert @result.include?('.something')
end
end