diff options
Diffstat (limited to 'Library/Homebrew')
| -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  | 
