Skip to content

Commit

Permalink
Merge pull request #358 from jeremyevans/fileutils-stdout-test-adjust
Browse files Browse the repository at this point in the history
Fix tests to work with current FileUtils
  • Loading branch information
hsbt committed Jul 16, 2020
2 parents 4fe73ff + bfdf462 commit 4a3de20
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions test/test_rake_clean.rb
Expand Up @@ -40,11 +40,20 @@ def test_cleanup_ignores_missing_files
def test_cleanup_trace
file_name = create_file

assert_output "", "rm -r #{file_name}\n" do
out, err = capture_io do
with_trace true do
Rake::Cleaner.cleanup(file_name)
end
end

if err == ""
# Current FileUtils
assert_equal "rm -r #{file_name}\n", out
else
# Old FileUtils
assert_equal "", out
assert_equal "rm -r #{file_name}\n", err
end
end

def test_cleanup_without_trace
Expand All @@ -70,11 +79,18 @@ def test_cleanup_opt_overrides_trace_silent
def test_cleanup_opt_overrides_trace_verbose
file_name = create_file

assert_output "", "rm -r #{file_name}\n" do
out, err = capture_io do
with_trace false do
Rake::Cleaner.cleanup(file_name, verbose: true)
end
end

if err == ""
assert_equal "rm -r #{file_name}\n", out
else
assert_equal "", out
assert_equal "rm -r #{file_name}\n", err
end
end

private
Expand Down

0 comments on commit 4a3de20

Please sign in to comment.