blob: b888f4315cadcee816d72c5c0a41589d6a939292 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
require_relative "../../rubocops/options_cop"
describe RuboCop::Cop::FormulaAudit::Options do
subject(:cop) { described_class.new }
it "reports an offense when using the 32-bit option" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'http://example.com/foo-1.0.tgz'
option "32-bit", "with 32-bit"
^^^^^^ macOS has been 64-bit only since 10.6 so 32-bit options are deprecated.
end
RUBY
end
end
describe RuboCop::Cop::FormulaAuditStrict::Options do
subject(:cop) { described_class.new }
context "When auditing options strictly" do
it "with universal" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'http://example.com/foo-1.0.tgz'
option :universal
^^^^^^^^^^^^^^^^^ macOS has been 64-bit only since 10.6 so universal options are deprecated.
end
RUBY
end
it "with deprecated options" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'http://example.com/foo-1.0.tgz'
option :cxx11
option "examples", "with-examples"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Options should begin with with/without. Migrate '--examples' with `deprecated_option`.
end
RUBY
end
it "with misc deprecated options" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'http://example.com/foo-1.0.tgz'
option "without-check"
^^^^^^^^^^^^^^^^^^^^^^ Use '--without-test' instead of '--without-check'. Migrate '--without-check' with `deprecated_option`.
end
RUBY
end
end
end
describe RuboCop::Cop::NewFormulaAudit::Options do
subject(:cop) { described_class.new }
context "When auditing options for a new formula" do
it "with deprecated options" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'http://example.com/foo-1.0.tgz'
deprecated_option "examples" => "with-examples"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ New Formula should not use `deprecated_option`
end
RUBY
end
end
end
|