aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorMike McQuaid2017-08-08 10:59:33 +0100
committerGitHub2017-08-08 10:59:33 +0100
commitfabcad3c6426105e9bfde9423c5981479be2d87e (patch)
tree1dfd6bab9424e06116edf81954d28215c6b43e94 /Library/Homebrew/test
parentae1986ac910a888ceda5a0b18d14a3b3b7bcb446 (diff)
parenta3219ca09cded33f80c2039c29f191b7369e2450 (diff)
downloadbrew-fabcad3c6426105e9bfde9423c5981479be2d87e.tar.bz2
Merge pull request #3012 from GauthamGoli/depends_on_fix
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