From e7190b9ae2ec39c98e9eb05e33edd1098f8f9085 Mon Sep 17 00:00:00 2001
From: Markus Reiter <me@reitermark.us>
Date: Thu, 23 Feb 2017 06:00:11 +0100
Subject: [PATCH] Convert `brew cleanup` test to spec.

---
 Library/Homebrew/test/cleanup_test.rb     |  7 -------
 Library/Homebrew/test/cmd/cleanup_spec.rb | 12 ++++++++++++
 2 files changed, 12 insertions(+), 7 deletions(-)
 create mode 100644 Library/Homebrew/test/cmd/cleanup_spec.rb

diff --git a/Library/Homebrew/test/cleanup_test.rb b/Library/Homebrew/test/cleanup_test.rb
index e6fc31dfe2..bc7a6713c6 100644
--- a/Library/Homebrew/test/cleanup_test.rb
+++ b/Library/Homebrew/test/cleanup_test.rb
@@ -5,13 +5,6 @@ require "fileutils"
 require "pathname"
 require "testing_env"
 
-class IntegrationCommandTestCleanup < IntegrationCommandTestCase
-  def test_cleanup
-    (HOMEBREW_CACHE/"test").write "test"
-    assert_match "#{HOMEBREW_CACHE}/test", cmd("cleanup", "--prune=all")
-  end
-end
-
 class CleanupTests < Homebrew::TestCase
   def setup
     super
diff --git a/Library/Homebrew/test/cmd/cleanup_spec.rb b/Library/Homebrew/test/cmd/cleanup_spec.rb
new file mode 100644
index 0000000000..9e2cf493f8
--- /dev/null
+++ b/Library/Homebrew/test/cmd/cleanup_spec.rb
@@ -0,0 +1,12 @@
+describe "brew cleanup", :integration_test do
+  describe "--prune=all" do
+    it "removes all files in Homebrew's cache" do
+      (HOMEBREW_CACHE/"test").write "test"
+
+      expect { brew "cleanup", "--prune=all" }
+        .to output(%r{#{Regexp.escape(HOMEBREW_CACHE)}/test}).to_stdout
+        .and not_to_output.to_stderr
+        .and be_a_success
+    end
+  end
+end
-- 
GitLab