diff options
| author | mansimarkaur | 2017-07-27 04:41:49 +0530 |
|---|---|---|
| committer | mansimarkaur | 2017-08-29 16:24:19 +0530 |
| commit | a4d4da64aab707e2f39fcc32fec6418cc39e8010 (patch) | |
| tree | 4b6405069e828c771174a642f3882d07683daec9 /Library/Homebrew/test/utils/analytics_spec.rb | |
| parent | 2a75c6c591c6bb0562ed25c84c951f70c9d8d90d (diff) | |
| download | brew-a4d4da64aab707e2f39fcc32fec6418cc39e8010.tar.bz2 | |
Added tests for os_prefix_ci
Diffstat (limited to 'Library/Homebrew/test/utils/analytics_spec.rb')
| -rw-r--r-- | Library/Homebrew/test/utils/analytics_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Library/Homebrew/test/utils/analytics_spec.rb b/Library/Homebrew/test/utils/analytics_spec.rb new file mode 100644 index 000000000..cee09e286 --- /dev/null +++ b/Library/Homebrew/test/utils/analytics_spec.rb @@ -0,0 +1,34 @@ +require "utils/analytics" + +describe Utils::Analytics do + describe "::os_prefix_ci" do + context "when anonymous_os_prefix_ci is not set" do + it "returns OS_VERSION and prefix when HOMEBREW_PREFIX is not /usr/local" do + expect(described_class.os_prefix_ci).to include("#{OS_VERSION}, non-/usr/local") + end + + it "includes CI when ENV['CI'] is set" do + allow(ENV).to receive(:[]).with("CI").and_return("true") + expect(described_class.os_prefix_ci).to include("CI") + end + + it "does not include prefix when HOMEBREW_PREFIX is usr/local" do + allow(HOMEBREW_PREFIX).to receive(:to_s).and_return("/usr/local") + expect(described_class.os_prefix_ci).not_to include("non-/usr/local") + end + end + + context "when anonymous_os_prefix_ci is set" do + let(:anonymous_os_prefix_ci) { "macOS 10.11.6, non-/usr/local, CI" } + + it "returns anonymous_os_prefix_ci" do + described_class.instance_variable_set(:@anonymous_os_prefix_ci, anonymous_os_prefix_ci) + expect(described_class.os_prefix_ci).to eq(anonymous_os_prefix_ci) + end + end + end + + describe "::" do + + end +end
\ No newline at end of file |
