aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorGautham Goli2017-08-06 14:48:39 +0530
committerGautham Goli2017-08-07 16:02:50 +0530
commita3219ca09cded33f80c2039c29f191b7369e2450 (patch)
tree4c68d1413f685bc0b76818b79a73233189688a0e /Library/Homebrew/test
parent8e89b9d9d06e52d183b9382fdb316139f1922f27 (diff)
downloadbrew-a3219ca09cded33f80c2039c29f191b7369e2450.tar.bz2
Add node pattern methods to handle dependency audits in a better way
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/rubocops/text_cop_spec.rb48
1 files changed, 48 insertions, 0 deletions
diff --git a/Library/Homebrew/test/rubocops/text_cop_spec.rb b/Library/Homebrew/test/rubocops/text_cop_spec.rb
index b218e9c25..ec13c4041 100644
--- a/Library/Homebrew/test/rubocops/text_cop_spec.rb
+++ b/Library/Homebrew/test/rubocops/text_cop_spec.rb
@@ -7,6 +7,54 @@ describe RuboCop::Cop::FormulaAudit::Text do
subject(:cop) { described_class.new }
context "When auditing formula text" do
+ it "with both openssl and libressl optional dependencies" do
+ source = <<-EOS.undent
+ class Foo < Formula
+ url "http://example.com/foo-1.0.tgz"
+ homepage "http://example.com"
+
+ depends_on "openssl"
+ depends_on "libressl" => :optional
+ end
+ EOS
+
+ expected_offenses = [{ message: "Formulae should not depend on both OpenSSL and LibreSSL (even optionally).",
+ severity: :convention,
+ line: 6,
+ column: 2,
+ source: source }]
+
+ inspect_source(cop, source)
+
+ expected_offenses.zip(cop.offenses).each do |expected, actual|
+ expect_offense(expected, actual)
+ end
+ end
+
+ it "with both openssl and libressl dependencies" do
+ source = <<-EOS.undent
+ class Foo < Formula
+ url "http://example.com/foo-1.0.tgz"
+ homepage "http://example.com"
+
+ depends_on "openssl"
+ depends_on "libressl"
+ end
+ EOS
+
+ expected_offenses = [{ message: "Formulae should not depend on both OpenSSL and LibreSSL (even optionally).",
+ severity: :convention,
+ line: 6,
+ column: 2,
+ source: source }]
+
+ inspect_source(cop, source)
+
+ expected_offenses.zip(cop.offenses).each do |expected, actual|
+ expect_offense(expected, actual)
+ end
+ end
+
it "When xcodebuild is called without SYMROOT" do
source = <<-EOS.undent
class Foo < Formula