Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests to work with current FileUtils #358

Merged
merged 1 commit into from
Jul 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions test/test_rake_clean.rb
Original file line number Diff line number Diff line change
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