aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/cask/dsl_spec.rb1
-rw-r--r--Library/Homebrew/test/utils/tty_spec.rb14
2 files changed, 14 insertions, 1 deletions
diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb
index d3bb46264..993c03bac 100644
--- a/Library/Homebrew/test/cask/dsl_spec.rb
+++ b/Library/Homebrew/test/cask/dsl_spec.rb
@@ -75,6 +75,7 @@ describe Hbc::DSL, :cask do
it "may use deprecated DSL version hash syntax" do
allow(ENV).to receive(:[]).with("HOMEBREW_DEVELOPER").and_return(nil)
+ allow(ENV).to receive(:[]).with("HOMEBREW_NO_COLOR").and_return(nil)
expect(cask.token).to eq("with-dsl-version")
expect(cask.url.to_s).to eq("http://example.com/TestCask.dmg")
diff --git a/Library/Homebrew/test/utils/tty_spec.rb b/Library/Homebrew/test/utils/tty_spec.rb
index 3ba89b6fd..e6c9168f3 100644
--- a/Library/Homebrew/test/utils/tty_spec.rb
+++ b/Library/Homebrew/test/utils/tty_spec.rb
@@ -53,7 +53,7 @@ describe Tty do
allow($stdout).to receive(:tty?).and_return(true)
end
- it "returns an empty string for all colors" do
+ it "returns ANSI escape codes for colors" do
expect(subject.to_s).to eq("")
expect(subject.red.to_s).to eq("\033[31m")
expect(subject.green.to_s).to eq("\033[32m")
@@ -63,5 +63,17 @@ describe Tty do
expect(subject.cyan.to_s).to eq("\033[36m")
expect(subject.default.to_s).to eq("\033[39m")
end
+
+ it "returns an empty string for all colors when HOMEBREW_NO_COLOR is set" do
+ ENV["HOMEBREW_NO_COLOR"] = "1"
+ expect(subject.to_s).to eq("")
+ expect(subject.red.to_s).to eq("")
+ expect(subject.green.to_s).to eq("")
+ expect(subject.yellow.to_s).to eq("")
+ expect(subject.blue.to_s).to eq("")
+ expect(subject.magenta.to_s).to eq("")
+ expect(subject.cyan.to_s).to eq("")
+ expect(subject.default.to_s).to eq("")
+ end
end
end