diff --git a/Library/Homebrew/test/utils/spdx_spec.rb b/Library/Homebrew/test/utils/spdx_spec.rb
index 9593f119ce7bd976c05fe9e48b47c676db820b31..01c02171dcfd988ea09eb89137727ad9c8e9d488 100644
--- a/Library/Homebrew/test/utils/spdx_spec.rb
+++ b/Library/Homebrew/test/utils/spdx_spec.rb
@@ -35,8 +35,8 @@ describe SPDX do
     let(:tmp_json_path) { Pathname.new(TEST_TMPDIR) }
 
     after do
-      FileUtils.rm tmp_json_path/"spdx_licenses.json"
-      FileUtils.rm tmp_json_path/"spdx_exceptions.json"
+      FileUtils.rm_f tmp_json_path/"spdx_licenses.json"
+      FileUtils.rm_f tmp_json_path/"spdx_exceptions.json"
     end
 
     it "downloads latest license data" do