test/cli_test.rb in deadweight-0.1.1 vs test/cli_test.rb in deadweight-0.1.2

- old
+ new

@@ -1,18 +1,21 @@ 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" + COMMAND = "ruby -rubygems -Ilib bin/deadweight" + FULL_COMMAND = "#{COMMAND} -s test/fixtures/style.css test/fixtures/index.html 2>/dev/null" should "output unused selectors on STDOUT" do - @result = `#{COMMAND}` - - assert_correct_selectors_in_output(@result) + assert_correct_selectors_in_output(`#{FULL_COMMAND}`) end should "accept CSS rules on STDIN" do - @result = `echo ".something { display: block; }" | #{COMMAND}` + assert `echo ".something { display: block; }" | #{FULL_COMMAND}`.include?('.something') + end - assert @result.include?('.something') + should "accept a [-r | --root] argument and relative paths" do + %w(-r --root).each do |arg| + assert_correct_selectors_in_output(`#{COMMAND} #{arg} test/fixtures -s /style.css /index.html 2>/dev/null`) + end end end