aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorGautham Goli2017-08-14 23:32:06 +0530
committerGautham Goli2017-08-14 23:32:06 +0530
commitd2a7314f538f919e9b09e4b27c1f86b7d3d2eda2 (patch)
treeee580c10310cc63c0e0c2947be0f95631f297cf1 /Library/Homebrew/test
parent64a929184a45f530a49af7b047d5b6605b50b1f8 (diff)
downloadbrew-d2a7314f538f919e9b09e4b27c1f86b7d3d2eda2.tar.bz2
add test for env mod through system call
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/rubocops/lines_cop_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/Library/Homebrew/test/rubocops/lines_cop_spec.rb b/Library/Homebrew/test/rubocops/lines_cop_spec.rb
index f3626cdce..be2b63c47 100644
--- a/Library/Homebrew/test/rubocops/lines_cop_spec.rb
+++ b/Library/Homebrew/test/rubocops/lines_cop_spec.rb
@@ -1073,6 +1073,28 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
end
end
+ it "with setting env manually" do
+ source = <<-EOS.undent
+ class Foo < Formula
+ desc "foo"
+ url 'http://example.com/foo-1.0.tgz'
+ system "export", "var=value"
+ end
+ EOS
+
+ expected_offenses = [{ message: "Use ENV instead of invoking 'export' to modify the environment",
+ severity: :convention,
+ line: 4,
+ column: 10,
+ source: source }]
+
+ inspect_source(cop, source)
+
+ expected_offenses.zip(cop.offenses).each do |expected, actual|
+ expect_offense(expected, actual)
+ end
+ end
+
end
def expect_offense(expected, actual)
expect(actual.message).to eq(expected[:message])