aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-24 17:03:56 +0100
committerGitHub2017-02-24 17:03:56 +0100
commitb7d3c6df627767ba59fc7834b6f9e1ba3c49c6a9 (patch)
treea4495f905af738ee5bca98b302d07de0a358d23a /Library
parent7cfd1d17f67b478b85cdb7313e57c8e449c7a7ed (diff)
parentd9b2974e02e4fce3d265f4b279c6d250bb46daf6 (diff)
downloadbrew-b7d3c6df627767ba59fc7834b6f9e1ba3c49c6a9.tar.bz2
Merge pull request #2158 from reitermarkus/spec---env
Convert `brew --env` test to spec.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/ENV_test.rb27
-rw-r--r--Library/Homebrew/test/cmd/--env_spec.rb44
2 files changed, 44 insertions, 27 deletions
diff --git a/Library/Homebrew/test/ENV_test.rb b/Library/Homebrew/test/ENV_test.rb
index cbfd01e25..66b59d8a4 100644
--- a/Library/Homebrew/test/ENV_test.rb
+++ b/Library/Homebrew/test/ENV_test.rb
@@ -2,33 +2,6 @@ require "testing_env"
require "extend/ENV"
require "testing_env"
-class IntegrationCommandTestEnv < IntegrationCommandTestCase
- def test_env
- assert_match(/CMAKE_PREFIX_PATH="#{Regexp.escape(HOMEBREW_PREFIX)}[:"]/,
- cmd("--env"))
- end
-
- def test_env_fish
- assert_match(/set [-]gx CMAKE_PREFIX_PATH "#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"/,
- cmd("--env", "--shell=fish"))
- end
-
- def test_env_csh
- assert_match(/setenv CMAKE_PREFIX_PATH #{Regexp.quote(HOMEBREW_PREFIX.to_s)};/,
- cmd("--env", "--shell=tcsh"))
- end
-
- def test_env_bash
- assert_match(/export CMAKE_PREFIX_PATH="#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"/,
- cmd("--env", "--shell=bash"))
- end
-
- def test_env_plain
- assert_match(/CMAKE_PREFIX_PATH: #{Regexp.quote(HOMEBREW_PREFIX)}/,
- cmd("--env", "--plain"))
- end
-end
-
module SharedEnvTests
def setup
super
diff --git a/Library/Homebrew/test/cmd/--env_spec.rb b/Library/Homebrew/test/cmd/--env_spec.rb
new file mode 100644
index 000000000..7dd84132a
--- /dev/null
+++ b/Library/Homebrew/test/cmd/--env_spec.rb
@@ -0,0 +1,44 @@
+describe "brew --env", :integration_test do
+ it "prints the Homebrew build environment variables" do
+ expect { brew "--env" }
+ .to output(/CMAKE_PREFIX_PATH="#{Regexp.escape(HOMEBREW_PREFIX)}[:"]/).to_stdout
+ .and not_to_output.to_stderr
+ .and be_a_success
+ end
+
+ describe "--shell=bash" do
+ it "prints the Homebrew build environment variables in Bash syntax" do
+ expect { brew "--env", "--shell=bash" }
+ .to output(/export CMAKE_PREFIX_PATH="#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"/).to_stdout
+ .and not_to_output.to_stderr
+ .and be_a_success
+ end
+ end
+
+ describe "--shell=fish" do
+ it "prints the Homebrew build environment variables in Fish syntax" do
+ expect { brew "--env", "--shell=fish" }
+ .to output(/set [-]gx CMAKE_PREFIX_PATH "#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"/).to_stdout
+ .and not_to_output.to_stderr
+ .and be_a_success
+ end
+ end
+
+ describe "--shell=tcsh" do
+ it "prints the Homebrew build environment variables in Tcsh syntax" do
+ expect { brew "--env", "--shell=tcsh" }
+ .to output(/setenv CMAKE_PREFIX_PATH #{Regexp.quote(HOMEBREW_PREFIX.to_s)};/).to_stdout
+ .and not_to_output.to_stderr
+ .and be_a_success
+ end
+ end
+
+ describe "--plain" do
+ it "prints the Homebrew build environment variables without quotes" do
+ expect { brew "--env", "--plain" }
+ .to output(/CMAKE_PREFIX_PATH: #{Regexp.quote(HOMEBREW_PREFIX)}/).to_stdout
+ .and not_to_output.to_stderr
+ .and be_a_success
+ end
+ end
+end