danger-spec_postfix 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/danger-spec_postfix.gemspec +1 -1
- data/gem_version.rb +1 -1
- data/lib/spec_postfix/gem_version.rb +1 -1
- data/lib/spec_postfix/plugin.rb +27 -31
- data/plugin.rb +10 -6
- data/spec/spec_helper.rb +2 -2
- data/spec/spec_postfix_spec.rb +2 -2
- data/spec_helper.rb +2 -2
- data/spec_postfix/gem_version.rb +1 -1
- data/spec_postfix/plugin.rb +10 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e736b77f25af05815d0056f34d6f08cf661b778d2eff55666bdec6aa3609943
|
4
|
+
data.tar.gz: 91597c48664c538ff8610390155d172013a6fe49f00016a8fed348e12b72312e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99ea9aed38ed6d1439fdcd1abb4bfa18a83a5ee04a049a94c6286d7e6f7b45a0a11a0fbc51e24ffe3182aedd5e1d9e190eccd4394e875cbbbad469ccaf91e36b
|
7
|
+
data.tar.gz: 073f9ad0dabe33fc140126b7091d8caf63695235e8ba5125bc6f867e6d073d6a7bcd4371d4352fba7d986a790c6dd48b3c8ba0c7c89392b9fcaa758956491fbf
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-spec_postfix (0.0.
|
4
|
+
danger-spec_postfix (0.0.2)
|
5
5
|
danger-plugin-api (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -96,7 +96,7 @@ GEM
|
|
96
96
|
rb-inotify (>= 0.9.7)
|
97
97
|
lumberjack (1.2.8)
|
98
98
|
method_source (1.0.0)
|
99
|
-
minitest (5.
|
99
|
+
minitest (5.17.0)
|
100
100
|
multipart-post (2.2.3)
|
101
101
|
nap (1.1.0)
|
102
102
|
nenv (0.3.0)
|
@@ -132,7 +132,7 @@ GEM
|
|
132
132
|
rspec-expectations (3.12.2)
|
133
133
|
diff-lcs (>= 1.2.0, < 2.0)
|
134
134
|
rspec-support (~> 3.12.0)
|
135
|
-
rspec-mocks (3.12.
|
135
|
+
rspec-mocks (3.12.3)
|
136
136
|
diff-lcs (>= 1.2.0, < 2.0)
|
137
137
|
rspec-support (~> 3.12.0)
|
138
138
|
rspec-support (3.12.0)
|
data/danger-spec_postfix.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = 'https://github.com/rambler-digital-solutions/danger-spec_postfix'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
|
-
spec.files = `git ls-files`.split(
|
16
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
data/gem_version.rb
CHANGED
data/lib/spec_postfix/plugin.rb
CHANGED
@@ -2,37 +2,39 @@
|
|
2
2
|
|
3
3
|
require 'active_support/configurable'
|
4
4
|
|
5
|
+
# Adding plugin
|
5
6
|
module Danger
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
#
|
18
|
-
# @param [String] files
|
19
|
-
# A globbed string which should return the files that you want to lint, defaults to nil.
|
20
|
-
# if nil, modified and added files from the diff will be used.
|
21
|
-
# @return [void]
|
22
|
-
#
|
23
|
-
def self.configuration
|
24
|
-
@configuration ||= Configuration.new
|
25
|
-
end
|
7
|
+
def self.configuration
|
8
|
+
@configuration ||= Configuration.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.configure
|
12
|
+
yield configuration
|
13
|
+
end
|
14
|
+
|
15
|
+
# Adding opportunity to maintain exceptions list for plugin.
|
16
|
+
class Configuration
|
17
|
+
include ::ActiveSupport::Configurable
|
26
18
|
|
27
|
-
|
28
|
-
|
19
|
+
config_accessor(:spec_postfix_exceptions) do
|
20
|
+
['spec/shared_examples/', 'spec/factories/', 'spec/support/', 'spec/rails_helper.rb', 'spec/spec_helper.rb']
|
29
21
|
end
|
22
|
+
end
|
30
23
|
|
24
|
+
# Lints the test files. Will fail if any has no '_spec' postfix.
|
25
|
+
# Generates a `string` with warning.
|
26
|
+
#
|
27
|
+
# @param [String] files
|
28
|
+
# A globbed string which should return the files that you want to lint, defaults to nil.
|
29
|
+
# if nil, modified and added files from the diff will be used.
|
30
|
+
# @return [void]
|
31
|
+
#
|
32
|
+
class DangerSpecPostfix < Plugin
|
31
33
|
def lint
|
32
34
|
changed_files.select { |f| f.match?(%r{^spec/.*rb$}) }
|
33
|
-
|
34
|
-
|
35
|
-
|
35
|
+
.reject { |f| f.end_with?('_spec.rb') }
|
36
|
+
.reject { |f| Danger.configuration.spec_postfix_exceptions.any? { |e| f.start_with?(e) } }
|
37
|
+
.each { |f| warn(warning_generator(f)) }
|
36
38
|
end
|
37
39
|
|
38
40
|
private
|
@@ -45,10 +47,4 @@ module Danger
|
|
45
47
|
"Tests should have `_spec` postfix: #{file}"
|
46
48
|
end
|
47
49
|
end
|
48
|
-
|
49
|
-
class DangerSpecPostfix::Configuration
|
50
|
-
include ::ActiveSupport::Configurable
|
51
|
-
|
52
|
-
config_accessor(:exceptions) { ['spec/shared_examples/', 'spec/factories/', 'spec/support/', 'spec/rails_helper.rb', 'spec/spec_helper.rb'] }
|
53
|
-
end
|
54
50
|
end
|
data/plugin.rb
CHANGED
@@ -30,9 +30,9 @@ module Danger
|
|
30
30
|
|
31
31
|
def lint
|
32
32
|
changed_files.select { |f| f.match?(%r{^spec/.*rb$}) }
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
.reject { |f| f.end_with?('_spec.rb') }
|
34
|
+
.reject { |f| DangerSpecPostfix.configuration.exceptions.any? { |e| f.start_with?(e) } }
|
35
|
+
.each { |f| warn(warning_generator(f)) }
|
36
36
|
end
|
37
37
|
|
38
38
|
private
|
@@ -46,9 +46,13 @@ module Danger
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
class DangerSpecPostfix
|
50
|
-
|
49
|
+
class DangerSpecPostfix
|
50
|
+
class Configuration
|
51
|
+
include ::ActiveSupport::Configurable
|
51
52
|
|
52
|
-
|
53
|
+
config_accessor(:exceptions) do
|
54
|
+
['spec/shared_examples/', 'spec/factories/', 'spec/support/', 'spec/rails_helper.rb', 'spec/spec_helper.rb']
|
55
|
+
end
|
56
|
+
end
|
53
57
|
end
|
54
58
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/spec_postfix_spec.rb
CHANGED
data/spec_helper.rb
CHANGED
data/spec_postfix/gem_version.rb
CHANGED
data/spec_postfix/plugin.rb
CHANGED
@@ -30,9 +30,9 @@ module Danger
|
|
30
30
|
|
31
31
|
def lint
|
32
32
|
changed_files.select { |f| f.match?(%r{^spec/.*rb$}) }
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
.reject { |f| f.end_with?('_spec.rb') }
|
34
|
+
.reject { |f| DangerSpecPostfix.configuration.exceptions.any? { |e| f.start_with?(e) } }
|
35
|
+
.each { |f| warn(warning_generator(f)) }
|
36
36
|
end
|
37
37
|
|
38
38
|
private
|
@@ -46,9 +46,13 @@ module Danger
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
class DangerSpecPostfix
|
50
|
-
|
49
|
+
class DangerSpecPostfix
|
50
|
+
class Configuration
|
51
|
+
include ::ActiveSupport::Configurable
|
51
52
|
|
52
|
-
|
53
|
+
config_accessor(:exceptions) do
|
54
|
+
['spec/shared_examples/', 'spec/factories/', 'spec/support/', 'spec/rails_helper.rb', 'spec/spec_helper.rb']
|
55
|
+
end
|
56
|
+
end
|
53
57
|
end
|
54
58
|
end
|