rubocop-cask 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d63ca3e510db69b8d8f41d4510b8a5c22e3fa924e77f24098db8c807db0be1f5
4
- data.tar.gz: 914b9055ffb625f72a1b24c818dc86c4e3a61ad0c7f7168620b52acca8855945
3
+ metadata.gz: 22d2072108140f809e919c9f1bfe3c9a7fbf095c5d16b2db1a5eb1c1ac2f5db5
4
+ data.tar.gz: db42b732f5139900a29cc9d461f7c405ae861fd515b280a6b517d772985cf313
5
5
  SHA512:
6
- metadata.gz: f5ff3d83882fbc630b5aa9ff880635d86f89971356badb2855f79750f741ba086f01e3710f86908f0ae29644a891fd958a4cec99d4ac04539fe3b7cf747b710e
7
- data.tar.gz: 07d5b5f3858b593a7d26d39b4e804337f53fa6413354dc5efcd2e6789265dcad51860484ccd76c61aa84663b077e1d32f73ce0520103981208128f282b8e53fa
6
+ metadata.gz: 7cedcd755c015b5cdcd97245f8c7c4feef9e51d24cdacc0a033376facea45a83b8f83b0be53cfb23a851b6183f5fcabbc7a87c9d952a6d9cb37ed186b312dfb3
7
+ data.tar.gz: b99489754639d326f3d3fcc3323301a26d75e55b76e07d83ab88f6f8d9aaa5b6a44bc6073cea2c2f933681d9c4241b2fecb9e99cba6a6ac226608d6ce397a1c3
data/README.md CHANGED
@@ -66,21 +66,21 @@ Cask/NoDslVersion:
66
66
 
67
67
  ## Contributing
68
68
 
69
- 1. Fork it
70
- 2. Create your feature branch (`git checkout -b my-new-feature`)
71
- 3. Commit your changes (`git commit -am 'Add some feature'`)
72
- 4. Push to the branch (`git push origin my-new-feature`)
73
- 5. Create new Pull Request
69
+ 1. Fork it.
70
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
71
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
72
+ 4. Push to the branch (`git push origin my-new-feature`).
73
+ 5. Create new pull request.
74
74
 
75
75
 
76
76
  ## Maintaining
77
77
 
78
78
  To publish a new release:
79
79
 
80
- 1. update the version in `lib/rubocop/cask/version.rb`
81
- 2. run `bundle exec rake build` to run tests and generate the changelog
82
- 3. commit the changes
83
- 4. run `bundle exec rake release`
80
+ 1. Update the version in `lib/rubocop/cask/version.rb`.
81
+ 2. Run `bundle exec rake build` to run tests and generate the changelog.
82
+ 3. Commit the changes.
83
+ 4. Create a new tag on GitHub.
84
84
 
85
85
 
86
86
  ## License
@@ -26,6 +26,7 @@ module RuboCop
26
26
 
27
27
  def stanzas
28
28
  return [] unless cask_body
29
+
29
30
  @stanzas ||= cask_body.each_node
30
31
  .select(&:stanza?)
31
32
  .map { |node| Stanza.new(node, stanza_comments(node)) }
@@ -3,6 +3,6 @@ require 'rubygems'
3
3
  module RuboCop
4
4
  module Cask
5
5
  # Version information for the Cask RuboCop plugin.
6
- VERSION = '0.21.0'.freeze
6
+ VERSION = '0.22.0'.freeze
7
7
  end
8
8
  end
@@ -30,6 +30,7 @@ module RuboCop
30
30
  def on_cask(cask_block)
31
31
  @cask_block = cask_block
32
32
  return unless homepage_stanza
33
+
33
34
  add_offenses
34
35
  end
35
36
 
@@ -122,6 +123,7 @@ module RuboCop
122
123
  def extract_url(stanza)
123
124
  string = stanza.stanza_node.children[2]
124
125
  return string.str_content if string.str_type?
126
+
125
127
  string.to_s.gsub(%r{.*"([a-z0-9]+\:\/\/[^"]+)".*}m, '\1')
126
128
  end
127
129
 
@@ -16,6 +16,7 @@ module RuboCop
16
16
  url = url_node.str_content
17
17
 
18
18
  return if url !~ %r{^.+://[^/]+$}
19
+
19
20
  add_offense(url_node, location: :expression,
20
21
  message: format(MSG_NO_SLASH, url: url))
21
22
  end
@@ -24,6 +24,7 @@ module RuboCop
24
24
  def on_cask(cask_block)
25
25
  @cask_header = cask_block.header
26
26
  return unless offense?
27
+
27
28
  offense
28
29
  end
29
30
 
@@ -42,6 +42,7 @@ module RuboCop
42
42
  def add_offenses
43
43
  toplevel_stanzas.each_cons(2) do |stanza, next_stanza|
44
44
  next unless next_stanza
45
+
45
46
  if missing_line_after?(stanza, next_stanza)
46
47
  add_offense_missing_line(stanza)
47
48
  elsif extra_line_after?(stanza, next_stanza)
@@ -0,0 +1,37 @@
1
+ describe RuboCop::Cask do
2
+ describe 'the default configuration file' do
3
+ subject(:default_config) {
4
+ RuboCop::ConfigLoader.load_file('config/default.yml')
5
+ }
6
+
7
+ let(:cop_names) {
8
+ cop_files = Dir.glob(File.join(__dir__, '..', '..', 'lib',
9
+ 'rubocop', 'cop', 'cask', '*.rb'))
10
+ cop_files.map { |file|
11
+ cop_name = File.basename(file, '.rb')
12
+ .gsub(/(^|_)(.)/) { Regexp.last_match(2).upcase }
13
+
14
+ "Cask/#{cop_name}"
15
+ }
16
+ }
17
+
18
+ let(:cask_config_keys) {
19
+ default_config.keys.select { |k| k.start_with?('Cask/') }
20
+ }
21
+
22
+ it 'includes all cops' do
23
+ expect(cask_config_keys.sort).to eq(cop_names.sort)
24
+ end
25
+
26
+ matcher :have_a_description do
27
+ match do |cop_name|
28
+ expect(default_config[cop_name]['Description']).not_to be nil
29
+ expect(default_config[cop_name]['Description']).not_to include("\n")
30
+ end
31
+ end
32
+
33
+ it 'has a nicely formatted description for all cops' do
34
+ expect(cop_names).to all have_a_description
35
+ end
36
+ end
37
+ end
@@ -3,176 +3,172 @@ describe RuboCop::Cop::Cask::HomepageMatchesUrl do
3
3
 
4
4
  subject(:cop) { described_class.new }
5
5
 
6
- context 'when the url matches the homepage' do
7
- context 'and there is no comment' do
8
- let(:source) do
9
- <<-CASK.undent
10
- cask 'foo' do
11
- url 'https://foo.example.com/foo.zip'
12
- homepage 'https://foo.example.com'
13
- end
14
- CASK
15
- end
16
-
17
- include_examples 'does not report any offenses'
6
+ context 'when the url matches the homepage and there is no comment' do
7
+ let(:source) do
8
+ <<-CASK.undent
9
+ cask 'foo' do
10
+ url 'https://foo.example.com/foo.zip'
11
+ homepage 'https://foo.example.com'
12
+ end
13
+ CASK
18
14
  end
19
15
 
20
- context 'and the url stanza has a referrer' do
21
- context 'and no interpolation' do
22
- let(:source) do
23
- <<-CASK.undent
24
- cask 'foo' do
25
- url 'https://foo.example.com/foo.zip',
26
- referrer: 'https://example.com/foo/'
27
- homepage 'https://foo.example.com'
28
- end
29
- CASK
16
+ include_examples 'does not report any offenses'
17
+ end
18
+
19
+ context 'when the url matches the homepage and the url stanza has ' \
20
+ 'a referrer and no interpolation' do
21
+ let(:source) do
22
+ <<-CASK.undent
23
+ cask 'foo' do
24
+ url 'https://foo.example.com/foo.zip',
25
+ referrer: 'https://example.com/foo/'
26
+ homepage 'https://foo.example.com'
30
27
  end
28
+ CASK
29
+ end
31
30
 
32
- include_examples 'does not report any offenses'
33
- end
31
+ include_examples 'does not report any offenses'
32
+ end
34
33
 
35
- context 'and interpolation' do
36
- let(:source) do
37
- <<-CASK.undent
38
- cask 'foo' do
39
- version '1.8.0_72,8.13.0.5'
40
- url "https://foo.example.com/foo-\#{version.after_comma}-\#{version.minor}.\#{version.patch}.\#{version.before_comma.sub(\%r{.*_}, '')}.zip",
41
- referrer: 'https://example.com/foo/'
42
- homepage 'https://foo.example.com'
43
- end
44
- CASK
34
+ context 'when the url matches the homepage and the url stanza has ' \
35
+ 'a referrer and interpolation' do
36
+ let(:source) do
37
+ <<-CASK.undent
38
+ cask 'foo' do
39
+ version '1.8.0_72,8.13.0.5'
40
+ url "https://foo.example.com/foo-\#{version.after_comma}-\#{version.minor}.\#{version.patch}.\#{version.before_comma.sub(\%r{.*_}, '')}.zip",
41
+ referrer: 'https://example.com/foo/'
42
+ homepage 'https://foo.example.com'
45
43
  end
46
-
47
- include_examples 'does not report any offenses'
48
- end
44
+ CASK
49
45
  end
50
46
 
51
- context 'but there is a comment' do
52
- context 'which does not match the url' do
53
- let(:source) do
54
- <<-CASK.undent
55
- cask 'foo' do
56
- # this is just a comment with information
57
- url 'https://example.com/foo.zip'
58
- homepage 'https://example.com'
59
- end
60
- CASK
47
+ include_examples 'does not report any offenses'
48
+ end
49
+
50
+ context 'when the url matches the homepage but there is a comment ' \
51
+ 'which does not match the url' do
52
+ let(:source) do
53
+ <<-CASK.undent
54
+ cask 'foo' do
55
+ # this is just a comment with information
56
+ url 'https://example.com/foo.zip'
57
+ homepage 'https://example.com'
61
58
  end
59
+ CASK
60
+ end
62
61
 
63
- include_examples 'does not report any offenses'
64
- end
62
+ include_examples 'does not report any offenses'
63
+ end
65
64
 
66
- context 'which matches the url' do
67
- let(:source) do
68
- <<-CASK.undent
69
- cask 'foo' do
70
- # foo.example.com was verified as official when first introduced to the cask
71
- url 'https://foo.example.com/foo.zip'
72
- homepage 'https://foo.example.com'
73
- end
74
- CASK
75
- end
76
- let(:expected_offenses) do
77
- [{
78
- message: '`foo.example.com` matches `example.com`, ' \
79
- 'the comment above the `url` stanza is unnecessary',
80
- severity: :convention,
81
- line: 2,
82
- column: 2,
83
- source: '# foo.example.com was verified as official when ' \
84
- 'first introduced to the cask'
85
- }]
65
+ context 'when the url matches the homepage ' \
66
+ 'but there is a comment matching the url' do
67
+ let(:source) do
68
+ <<-CASK.undent
69
+ cask 'foo' do
70
+ # foo.example.com was verified as official when first introduced to the cask
71
+ url 'https://foo.example.com/foo.zip'
72
+ homepage 'https://foo.example.com'
86
73
  end
87
-
88
- include_examples 'reports offenses'
89
- end
74
+ CASK
75
+ end
76
+ let(:expected_offenses) do
77
+ [{
78
+ message: '`foo.example.com` matches `example.com`, ' \
79
+ 'the comment above the `url` stanza is unnecessary',
80
+ severity: :convention,
81
+ line: 2,
82
+ column: 2,
83
+ source: '# foo.example.com was verified as official when ' \
84
+ 'first introduced to the cask'
85
+ }]
90
86
  end
87
+
88
+ include_examples 'reports offenses'
91
89
  end
92
90
 
93
91
  context 'when the url does not match the homepage' do
94
- context 'and there is a comment' do
95
- context 'which matches the url' do
96
- context 'but does not match the expected format' do
97
- let(:source) do
98
- <<-CASK.undent
99
- cask 'foo' do
100
- # example.com was verified as official
101
- url 'https://example.com/foo.zip'
102
- homepage 'https://foo.example.org'
103
- end
104
- CASK
105
- end
106
- let(:expected_offenses) do
107
- [{
108
- message: '`# example.com was verified as official` does not ' \
109
- 'match the expected comment format. For details, see ' \
110
- 'https://github.com/Homebrew/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment',
111
- severity: :convention,
112
- line: 2,
113
- column: 2,
114
- source: '# example.com was verified as official'
115
- }]
92
+ context 'when there is a comment matching the url ' \
93
+ 'but not matching the expected format' do
94
+ let(:source) do
95
+ <<-CASK.undent
96
+ cask 'foo' do
97
+ # example.com was verified as official
98
+ url 'https://example.com/foo.zip'
99
+ homepage 'https://foo.example.org'
116
100
  end
101
+ CASK
102
+ end
103
+ let(:expected_offenses) do
104
+ [{
105
+ message: '`# example.com was verified as official` does not ' \
106
+ 'match the expected comment format. For details, see ' \
107
+ 'https://github.com/Homebrew/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment',
108
+ severity: :convention,
109
+ line: 2,
110
+ column: 2,
111
+ source: '# example.com was verified as official'
112
+ }]
113
+ end
117
114
 
118
- include_examples 'reports offenses'
119
- end
115
+ include_examples 'reports offenses'
116
+ end
120
117
 
121
- context 'and does not have slashes' do
122
- let(:source) do
123
- <<-CASK.undent
124
- cask 'foo' do
125
- # example.com was verified as official when first introduced to the cask
126
- url 'https://example.com/foo.zip'
127
- homepage 'https://foo.example.org'
128
- end
129
- CASK
118
+ context 'when there is a comment matching the url ' \
119
+ 'and does not have slashes' do
120
+ let(:source) do
121
+ <<-CASK.undent
122
+ cask 'foo' do
123
+ # example.com was verified as official when first introduced to the cask
124
+ url 'https://example.com/foo.zip'
125
+ homepage 'https://foo.example.org'
130
126
  end
127
+ CASK
128
+ end
131
129
 
132
- include_examples 'does not report any offenses'
133
- end
130
+ include_examples 'does not report any offenses'
131
+ end
134
132
 
135
- context 'and has slashes' do
136
- let(:source) do
137
- <<-CASK.undent
138
- cask 'foo' do
139
- # example.com/vendor/app was verified as official when first introduced to the cask
140
- url 'https://downloads.example.com/vendor/app/foo.zip'
141
- homepage 'https://vendor.example.org/app/'
142
- end
143
- CASK
133
+ context 'when there is a comment matching the url and has slashes' do
134
+ let(:source) do
135
+ <<-CASK.undent
136
+ cask 'foo' do
137
+ # example.com/vendor/app was verified as official when first introduced to the cask
138
+ url 'https://downloads.example.com/vendor/app/foo.zip'
139
+ homepage 'https://vendor.example.org/app/'
144
140
  end
145
-
146
- include_examples 'does not report any offenses'
147
- end
141
+ CASK
148
142
  end
149
143
 
150
- context 'which does not match the url' do
151
- let(:source) do
152
- <<-CASK.undent
153
- cask 'foo' do
154
- # example.com was verified as official when first introduced to the cask
155
- url 'https://example.org/foo.zip'
156
- homepage 'https://foo.example.com'
157
- end
158
- CASK
159
- end
160
- let(:expected_offenses) do
161
- [{
162
- message: '`example.com` does not match `example.org/foo.zip`',
163
- severity: :convention,
164
- line: 2,
165
- column: 2,
166
- source: '# example.com was verified as official when ' \
167
- 'first introduced to the cask'
168
- }]
169
- end
144
+ include_examples 'does not report any offenses'
145
+ end
170
146
 
171
- include_examples 'reports offenses'
147
+ context 'when there is a comment which does not match the url' do
148
+ let(:source) do
149
+ <<-CASK.undent
150
+ cask 'foo' do
151
+ # example.com was verified as official when first introduced to the cask
152
+ url 'https://example.org/foo.zip'
153
+ homepage 'https://foo.example.com'
154
+ end
155
+ CASK
156
+ end
157
+ let(:expected_offenses) do
158
+ [{
159
+ message: '`example.com` does not match `example.org/foo.zip`',
160
+ severity: :convention,
161
+ line: 2,
162
+ column: 2,
163
+ source: '# example.com was verified as official when ' \
164
+ 'first introduced to the cask'
165
+ }]
172
166
  end
167
+
168
+ include_examples 'reports offenses'
173
169
  end
174
170
 
175
- context 'but the comment is missing' do
171
+ context 'when the comment is missing' do
176
172
  let(:source) do
177
173
  <<-CASK.undent
178
174
  cask 'foo' do
@@ -15,48 +15,46 @@ describe RuboCop::Cop::Cask::HomepageUrlTrailingSlash do
15
15
  include_examples 'does not report any offenses'
16
16
  end
17
17
 
18
- context 'when the homepage url does not end with a slash' do
19
- context 'but has a path' do
20
- let(:source) do
21
- <<-CASK.undent
22
- cask 'foo' do
23
- homepage 'https://foo.example.com/path'
24
- end
25
- CASK
26
- end
27
-
28
- include_examples 'does not report any offenses'
18
+ context 'when the homepage url does not end with a slash but has a path' do
19
+ let(:source) do
20
+ <<-CASK.undent
21
+ cask 'foo' do
22
+ homepage 'https://foo.example.com/path'
23
+ end
24
+ CASK
29
25
  end
30
26
 
31
- context 'and has no path' do
32
- let(:source) do
33
- <<-CASK.undent
34
- cask 'foo' do
35
- homepage 'https://foo.example.com'
36
- end
37
- CASK
38
- end
39
- let(:correct_source) do
40
- <<-CASK.undent
41
- cask 'foo' do
42
- homepage 'https://foo.example.com/'
43
- end
44
- CASK
45
- end
46
- let(:expected_offenses) do
47
- [{
48
- message: "'https://foo.example.com' must have a slash "\
49
- 'after the domain.',
50
- severity: :convention,
51
- line: 2,
52
- column: 11,
53
- source: "'https://foo.example.com'"
54
- }]
55
- end
56
-
57
- include_examples 'reports offenses'
58
-
59
- include_examples 'autocorrects source'
27
+ include_examples 'does not report any offenses'
28
+ end
29
+
30
+ context 'when the homepage url does not end with a slash and has no path' do
31
+ let(:source) do
32
+ <<-CASK.undent
33
+ cask 'foo' do
34
+ homepage 'https://foo.example.com'
35
+ end
36
+ CASK
60
37
  end
38
+ let(:correct_source) do
39
+ <<-CASK.undent
40
+ cask 'foo' do
41
+ homepage 'https://foo.example.com/'
42
+ end
43
+ CASK
44
+ end
45
+ let(:expected_offenses) do
46
+ [{
47
+ message: "'https://foo.example.com' must have a slash "\
48
+ 'after the domain.',
49
+ severity: :convention,
50
+ line: 2,
51
+ column: 11,
52
+ source: "'https://foo.example.com'"
53
+ }]
54
+ end
55
+
56
+ include_examples 'reports offenses'
57
+
58
+ include_examples 'autocorrects source'
61
59
  end
62
60
  end
@@ -2,6 +2,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
2
2
  include CopSharedExamples
3
3
 
4
4
  subject(:cop) { described_class.new }
5
+
5
6
  let(:missing_line_msg) do
6
7
  'stanza groups should be separated by a single empty line'
7
8
  end
data/spec/spec_helper.rb CHANGED
@@ -7,7 +7,9 @@ if ENV['COVERAGE']
7
7
  end
8
8
 
9
9
  project_path = File.join(File.dirname(__FILE__), '..')
10
- Dir["#{project_path}/spec/support/**/*.rb"].each { |f| require f }
10
+ Dir["#{project_path}/spec/support/**/*.rb"].each do |f|
11
+ require f
12
+ end
11
13
 
12
14
  RSpec.configure do |config|
13
15
  config.order = :random
@@ -21,6 +23,5 @@ RSpec.configure do |config|
21
23
  end
22
24
  end
23
25
 
24
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
25
- $LOAD_PATH.unshift(File.dirname(__FILE__))
26
+ $LOAD_PATH.unshift(File.join(__dir__, '..', 'lib'))
26
27
  require 'rubocop-cask'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-cask
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Hagins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-16 00:00:00.000000000 Z
11
+ date: 2018-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: public_suffix
@@ -16,28 +16,34 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.2
19
+ version: '3.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.3
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: 3.0.2
29
+ version: '3.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.3
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rubocop
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: 0.58.2
39
+ version: 0.59.1
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: 0.58.2
46
+ version: 0.59.1
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: bundler
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +58,20 @@ dependencies:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
60
  version: '1.16'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rubocop-rspec
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
55
75
  description: |2
56
76
  Code style checking for Homebrew-Cask files.
57
77
  A plugin for the RuboCop code style enforcing & linting tool.
@@ -81,7 +101,7 @@ files:
81
101
  - lib/rubocop/cop/cask/no_dsl_version.rb
82
102
  - lib/rubocop/cop/cask/stanza_grouping.rb
83
103
  - lib/rubocop/cop/cask/stanza_order.rb
84
- - spec/project_spec.rb
104
+ - spec/rubocop/cask_spec.rb
85
105
  - spec/rubocop/cop/cask/homepage_matches_url_spec.rb
86
106
  - spec/rubocop/cop/cask/homepage_url_trailing_slash_spec.rb
87
107
  - spec/rubocop/cop/cask/no_dsl_version_spec.rb
@@ -114,7 +134,7 @@ signing_key:
114
134
  specification_version: 4
115
135
  summary: Code style checking for Homebrew-Cask files
116
136
  test_files:
117
- - spec/project_spec.rb
137
+ - spec/rubocop/cask_spec.rb
118
138
  - spec/rubocop/cop/cask/homepage_matches_url_spec.rb
119
139
  - spec/rubocop/cop/cask/homepage_url_trailing_slash_spec.rb
120
140
  - spec/rubocop/cop/cask/no_dsl_version_spec.rb
data/spec/project_spec.rb DELETED
@@ -1,34 +0,0 @@
1
- describe 'RuboCop Project' do
2
- describe 'default configuration file' do
3
- let(:cop_names) do
4
- cop_files = Dir.glob(File.join(File.dirname(__FILE__), '..', 'lib',
5
- 'rubocop', 'cop', 'cask', '*.rb'))
6
- cop_files.map do |file|
7
- cop_name = File.basename(file, '.rb')
8
- .gsub(/(^|_)(.)/) { Regexp.last_match(2).upcase }
9
-
10
- "Cask/#{cop_name}"
11
- end
12
- end
13
-
14
- subject(:default_config) do
15
- RuboCop::ConfigLoader.load_file('config/default.yml')
16
- end
17
-
18
- let(:cask_config_keys) do
19
- default_config.keys.select { |k| k.start_with?('Cask/') }
20
- end
21
-
22
- it 'has configuration for all cops' do
23
- expect(cask_config_keys.sort).to eq(cop_names.sort)
24
- end
25
-
26
- it 'has a nicely formatted description for all cops' do
27
- cop_names.each do |name|
28
- description = default_config[name]['Description']
29
- expect(description).not_to be_nil
30
- expect(description).not_to include("\n")
31
- end
32
- end
33
- end
34
- end