polishgeeks-dev-tools 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +18 -38
- data/README.md +1 -1
- data/config/rubocop.yml +3 -1
- data/config/rubocop_rspec.yml +2 -0
- data/lib/polish_geeks/dev_tools/commands/examples_comparator.rb +12 -2
- data/lib/polish_geeks/dev_tools/commands/rubocop.rb +1 -0
- data/lib/polish_geeks/dev_tools/version.rb +1 -1
- data/spec/lib/polish_geeks/dev_tools/commands/empty_methods_spec.rb +15 -9
- data/spec/lib/polish_geeks/dev_tools/commands/examples_comparator_spec.rb +44 -21
- data/spec/lib/polish_geeks/dev_tools/commands/expires_in_spec.rb +13 -11
- data/spec/lib/polish_geeks/dev_tools/commands/final_blank_line_spec.rb +16 -8
- data/spec/lib/polish_geeks/dev_tools/commands/required_files_spec.rb +3 -4
- data/spec/lib/polish_geeks/dev_tools/commands/rspec_files_structure_spec.rb +28 -22
- data/spec/lib/polish_geeks/dev_tools/commands/rubocop_spec.rb +4 -2
- data/spec/lib/polish_geeks/dev_tools/validators/rubocop_spec.rb +6 -6
- data/spec/lib/polish_geeks/dev_tools/validators/simplecov_spec.rb +13 -3
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea68396ef20461f7c319bf534b51004343fa0223
|
|
4
|
+
data.tar.gz: 683ada98afdca85a2328d1da750a5e804ba4c37f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a8f5d62c2bb3c8896c7badc10e40450879faf9076d7e32ab156907b82db247c12d01cfe58a1c16b1e262c1b429f3ead38bc084c093950aeccfd751916931dbfd
|
|
7
|
+
data.tar.gz: 4e81520a2babbe0b80dbad48c0c97752b8af6951576167496af7e593e91f81bfbf342dd78650c48699a1ed83ae1285e809e26590ee6d9029ecbdf32c4f2eda59
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
polishgeeks-dev-tools (1.3.
|
|
4
|
+
polishgeeks-dev-tools (1.3.2)
|
|
5
5
|
brakeman
|
|
6
6
|
bundler-audit
|
|
7
7
|
faker
|
|
@@ -26,21 +26,12 @@ GEM
|
|
|
26
26
|
thread_safe (~> 0.3, >= 0.3.4)
|
|
27
27
|
tzinfo (~> 1.1)
|
|
28
28
|
addressable (2.4.0)
|
|
29
|
-
ast (2.
|
|
29
|
+
ast (2.3.0)
|
|
30
30
|
axiom-types (0.1.1)
|
|
31
31
|
descendants_tracker (~> 0.0.4)
|
|
32
32
|
ice_nine (~> 0.11.0)
|
|
33
33
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
34
|
-
brakeman (3.2
|
|
35
|
-
erubis (~> 2.6)
|
|
36
|
-
haml (>= 3.0, < 5.0)
|
|
37
|
-
highline (>= 1.6.20, < 2.0)
|
|
38
|
-
ruby2ruby (~> 2.3.0)
|
|
39
|
-
ruby_parser (~> 3.8.1)
|
|
40
|
-
safe_yaml (>= 1.0)
|
|
41
|
-
sass (~> 3.0)
|
|
42
|
-
slim (>= 1.3.6, < 4.0)
|
|
43
|
-
terminal-table (~> 1.4)
|
|
34
|
+
brakeman (3.3.2)
|
|
44
35
|
bundler-audit (0.5.0)
|
|
45
36
|
bundler (~> 1.2)
|
|
46
37
|
thor (~> 0.18)
|
|
@@ -49,7 +40,7 @@ GEM
|
|
|
49
40
|
coderay (1.1.1)
|
|
50
41
|
coercible (1.0.0)
|
|
51
42
|
descendants_tracker (~> 0.0.1)
|
|
52
|
-
colorize (0.
|
|
43
|
+
colorize (0.8.0)
|
|
53
44
|
descendants_tracker (0.0.4)
|
|
54
45
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
55
46
|
diff-lcs (1.2.5)
|
|
@@ -72,15 +63,14 @@ GEM
|
|
|
72
63
|
rake (>= 10, < 12)
|
|
73
64
|
rubocop (>= 0.36.0)
|
|
74
65
|
sysexits (~> 1.1)
|
|
75
|
-
highline (1.7.8)
|
|
76
66
|
i18n (0.7.0)
|
|
77
67
|
ice_nine (0.11.2)
|
|
78
68
|
json (1.8.3)
|
|
79
69
|
launchy (2.4.3)
|
|
80
70
|
addressable (~> 2.3)
|
|
81
71
|
method_source (0.8.2)
|
|
82
|
-
minitest (5.
|
|
83
|
-
parser (2.3.0
|
|
72
|
+
minitest (5.9.0)
|
|
73
|
+
parser (2.3.1.0)
|
|
84
74
|
ast (~> 2.2)
|
|
85
75
|
powerpack (0.1.1)
|
|
86
76
|
pry (0.10.3)
|
|
@@ -89,7 +79,7 @@ GEM
|
|
|
89
79
|
slop (~> 3.4)
|
|
90
80
|
rainbow (2.1.0)
|
|
91
81
|
rake (11.1.2)
|
|
92
|
-
reek (4.0.
|
|
82
|
+
reek (4.0.2)
|
|
93
83
|
codeclimate-engine-rb (~> 0.3.1)
|
|
94
84
|
parser (~> 2.3, >= 2.3.0.6)
|
|
95
85
|
rainbow (~> 2.0)
|
|
@@ -106,31 +96,26 @@ GEM
|
|
|
106
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
107
97
|
rspec-support (~> 3.4.0)
|
|
108
98
|
rspec-support (3.4.1)
|
|
109
|
-
rubocop (0.
|
|
110
|
-
parser (>= 2.3.0
|
|
99
|
+
rubocop (0.40.0)
|
|
100
|
+
parser (>= 2.3.1.0, < 3.0)
|
|
111
101
|
powerpack (~> 0.1)
|
|
112
102
|
rainbow (>= 1.99.1, < 3.0)
|
|
113
103
|
ruby-progressbar (~> 1.7)
|
|
114
104
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
115
|
-
rubocop-rspec (1.
|
|
116
|
-
rubocop (
|
|
117
|
-
ruby-progressbar (1.
|
|
118
|
-
|
|
119
|
-
ruby_parser (~> 3.1)
|
|
120
|
-
sexp_processor (~> 4.0)
|
|
121
|
-
ruby_parser (3.8.1)
|
|
105
|
+
rubocop-rspec (1.5.0)
|
|
106
|
+
rubocop (>= 0.40.0)
|
|
107
|
+
ruby-progressbar (1.8.1)
|
|
108
|
+
ruby_parser (3.8.2)
|
|
122
109
|
sexp_processor (~> 4.1)
|
|
123
|
-
rubycritic (2.9.
|
|
110
|
+
rubycritic (2.9.1)
|
|
124
111
|
colorize
|
|
125
112
|
flay (= 2.7.0)
|
|
126
113
|
flog (= 4.3.2)
|
|
127
114
|
launchy (= 2.4.3)
|
|
128
|
-
parser (= 2.3.0
|
|
129
|
-
reek (= 4.0.
|
|
115
|
+
parser (= 2.3.1.0)
|
|
116
|
+
reek (= 4.0.2)
|
|
130
117
|
ruby_parser (~> 3.8)
|
|
131
118
|
virtus (~> 1.0)
|
|
132
|
-
safe_yaml (1.0.4)
|
|
133
|
-
sass (3.4.22)
|
|
134
119
|
sexp_processor (4.7.0)
|
|
135
120
|
shoulda (3.5.0)
|
|
136
121
|
shoulda-context (~> 1.0, >= 1.0.1)
|
|
@@ -143,20 +128,15 @@ GEM
|
|
|
143
128
|
json (~> 1.8)
|
|
144
129
|
simplecov-html (~> 0.10.0)
|
|
145
130
|
simplecov-html (0.10.0)
|
|
146
|
-
slim (3.0.6)
|
|
147
|
-
temple (~> 0.7.3)
|
|
148
|
-
tilt (>= 1.3.3, < 2.1)
|
|
149
131
|
slop (3.6.0)
|
|
150
132
|
sysexits (1.2.0)
|
|
151
|
-
temple (0.7.6)
|
|
152
|
-
terminal-table (1.5.2)
|
|
153
133
|
thor (0.19.1)
|
|
154
134
|
thread_safe (0.3.5)
|
|
155
|
-
tilt (2.0.
|
|
135
|
+
tilt (2.0.5)
|
|
156
136
|
timecop (0.8.1)
|
|
157
137
|
tzinfo (1.2.2)
|
|
158
138
|
thread_safe (~> 0.1)
|
|
159
|
-
unicode-display_width (1.0
|
|
139
|
+
unicode-display_width (1.1.0)
|
|
160
140
|
virtus (1.0.5)
|
|
161
141
|
axiom-types (~> 0.1)
|
|
162
142
|
coercible (~> 1.0)
|
data/README.md
CHANGED
|
@@ -55,7 +55,7 @@ determine, which you can use in your project:
|
|
|
55
55
|
| rubocop_rspec | - | Used to check RSpec syntax according to our styling |
|
|
56
56
|
| final_blank_line | - | Check if all files have final blank line |
|
|
57
57
|
| empty_methods | - | Check if some files have empty methods |
|
|
58
|
-
| expires_in | - | Checks if there are typos like expire_in, etc that might
|
|
58
|
+
| expires_in | - | Checks if there are typos like expire_in, etc that might break app caching |
|
|
59
59
|
| haml_lint | - | User to check HAML syntax in the app views |
|
|
60
60
|
| yard | - | YARD documentation standards checking |
|
|
61
61
|
| rspec_files_names | - | Checks if all the rspec files have proper sufix (_spec.rb) |
|
data/config/rubocop.yml
CHANGED
|
@@ -13,8 +13,12 @@ module PolishGeeks
|
|
|
13
13
|
|
|
14
14
|
Dir[config_path].each do |example_file|
|
|
15
15
|
dedicated_file = example_file.gsub('.example', '')
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
if File.exist?(dedicated_file)
|
|
17
|
+
header = compare_header(example_file, dedicated_file)
|
|
18
|
+
@output << compare_output(header, example_file, dedicated_file)
|
|
19
|
+
else
|
|
20
|
+
@output << missing_file(dedicated_file)
|
|
21
|
+
end
|
|
18
22
|
end
|
|
19
23
|
end
|
|
20
24
|
|
|
@@ -75,6 +79,12 @@ module PolishGeeks
|
|
|
75
79
|
def failed_compare(compare_header)
|
|
76
80
|
"\e[31m failed\e[0m - #{compare_header} - structure not equal\n"
|
|
77
81
|
end
|
|
82
|
+
|
|
83
|
+
# @param [String] dedicated_file path to config file which is missing
|
|
84
|
+
# @return [String] failed message for missing file
|
|
85
|
+
def missing_file(dedicated_file)
|
|
86
|
+
"\e[31m failed\e[0m - #{File.basename(dedicated_file)} - file is missing\n"
|
|
87
|
+
end
|
|
78
88
|
end
|
|
79
89
|
end
|
|
80
90
|
end
|
|
@@ -18,6 +18,7 @@ module PolishGeeks
|
|
|
18
18
|
cmd = ["bundle exec rubocop #{PolishGeeks::DevTools.app_root}"]
|
|
19
19
|
cmd << "-c #{self.class.config_manager.path}" if self.class.config_manager.present?
|
|
20
20
|
cmd << '--require rubocop-rspec' if Config.config.rubocop_rspec?
|
|
21
|
+
cmd << '--display-cop-names'
|
|
21
22
|
@output = Shell.new.execute(cmd.join(' '))
|
|
22
23
|
end
|
|
23
24
|
|
|
@@ -131,24 +131,30 @@ RSpec.describe PolishGeeks::DevTools::Commands::EmptyMethods do
|
|
|
131
131
|
describe '#config_excludes' do
|
|
132
132
|
context 'empty_methods_ignored is set' do
|
|
133
133
|
let(:paths) { ["#{rand}.rb", "#{rand}.rb"] }
|
|
134
|
-
let(:config)
|
|
134
|
+
let(:config) do
|
|
135
|
+
instance_double(
|
|
136
|
+
PolishGeeks::DevTools::Config,
|
|
137
|
+
empty_methods_ignored: paths
|
|
138
|
+
)
|
|
139
|
+
end
|
|
135
140
|
|
|
136
141
|
before do
|
|
137
|
-
expect(PolishGeeks::DevTools)
|
|
138
|
-
.to receive(:config)
|
|
139
|
-
.and_return config
|
|
142
|
+
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
|
140
143
|
end
|
|
141
144
|
|
|
142
|
-
it { expect(subject.send(:config_excludes)).to eq
|
|
145
|
+
it { expect(subject.send(:config_excludes)).to eq(paths) }
|
|
143
146
|
end
|
|
144
147
|
|
|
145
148
|
context 'empty_methods_ignored is not set' do
|
|
146
|
-
let(:config)
|
|
149
|
+
let(:config) do
|
|
150
|
+
instance_double(
|
|
151
|
+
PolishGeeks::DevTools::Config,
|
|
152
|
+
empty_methods_ignored: nil
|
|
153
|
+
)
|
|
154
|
+
end
|
|
147
155
|
|
|
148
156
|
before do
|
|
149
|
-
expect(PolishGeeks::DevTools)
|
|
150
|
-
.to receive(:config)
|
|
151
|
-
.and_return config
|
|
157
|
+
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
|
152
158
|
end
|
|
153
159
|
|
|
154
160
|
it { expect(subject.send(:config_excludes)).to eq [] }
|
|
@@ -4,7 +4,8 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
|
4
4
|
subject { described_class.new }
|
|
5
5
|
|
|
6
6
|
let(:example_file) { rand.to_s }
|
|
7
|
-
let(:dedicated_file) {
|
|
7
|
+
let(:dedicated_file) { example_file }
|
|
8
|
+
let(:dedicated_file_present) { true }
|
|
8
9
|
|
|
9
10
|
describe '#execute' do
|
|
10
11
|
let(:config_path) { rand.to_s }
|
|
@@ -14,19 +15,26 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
|
14
15
|
.to receive(:config_path)
|
|
15
16
|
.and_return(config_path)
|
|
16
17
|
|
|
17
|
-
expect(subject)
|
|
18
|
-
.to receive(:same_key_structure?)
|
|
19
|
-
.and_return(compare_result)
|
|
20
|
-
|
|
21
18
|
expect(Dir)
|
|
22
19
|
.to receive(:[])
|
|
23
20
|
.with(config_path)
|
|
24
21
|
.and_return([example_file])
|
|
22
|
+
|
|
23
|
+
expect(File)
|
|
24
|
+
.to receive(:exist?)
|
|
25
|
+
.with(dedicated_file)
|
|
26
|
+
.and_return(dedicated_file_present)
|
|
25
27
|
end
|
|
26
28
|
|
|
27
29
|
context 'when compared files structure is the same' do
|
|
28
30
|
let(:compare_result) { true }
|
|
29
31
|
|
|
32
|
+
before do
|
|
33
|
+
expect(subject)
|
|
34
|
+
.to receive(:same_key_structure?)
|
|
35
|
+
.and_return(compare_result)
|
|
36
|
+
end
|
|
37
|
+
|
|
30
38
|
it 'puts a successful message into output' do
|
|
31
39
|
subject.execute
|
|
32
40
|
|
|
@@ -37,11 +45,26 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
|
37
45
|
context 'when compared files structure is not the same' do
|
|
38
46
|
let(:compare_result) { false }
|
|
39
47
|
|
|
48
|
+
before do
|
|
49
|
+
expect(subject)
|
|
50
|
+
.to receive(:same_key_structure?)
|
|
51
|
+
.and_return(compare_result)
|
|
52
|
+
end
|
|
53
|
+
|
|
40
54
|
it 'puts a failed message into output' do
|
|
41
55
|
subject.execute
|
|
42
56
|
expect(subject.output).to include 'failed'
|
|
43
57
|
end
|
|
44
58
|
end
|
|
59
|
+
|
|
60
|
+
context 'when dedicated file is not present' do
|
|
61
|
+
let(:dedicated_file_present) { false }
|
|
62
|
+
|
|
63
|
+
it 'puts a failed message into output' do
|
|
64
|
+
subject.execute
|
|
65
|
+
expect(subject.output).to include 'file is missing'
|
|
66
|
+
end
|
|
67
|
+
end
|
|
45
68
|
end
|
|
46
69
|
|
|
47
70
|
describe '#config_path' do
|
|
@@ -113,28 +136,28 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
|
113
136
|
context 'when structure is the same' do
|
|
114
137
|
let(:result) { true }
|
|
115
138
|
|
|
116
|
-
it
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
139
|
+
it do
|
|
140
|
+
expect(
|
|
141
|
+
subject.send(
|
|
142
|
+
:same_key_structure?,
|
|
143
|
+
example_file,
|
|
144
|
+
dedicated_file
|
|
145
|
+
)
|
|
146
|
+
).to eq(result)
|
|
124
147
|
end
|
|
125
148
|
end
|
|
126
149
|
|
|
127
150
|
context 'when structure is not the same' do
|
|
128
151
|
let(:result) { false }
|
|
129
152
|
|
|
130
|
-
it
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
153
|
+
it do
|
|
154
|
+
expect(
|
|
155
|
+
subject.send(
|
|
156
|
+
:same_key_structure?,
|
|
157
|
+
example_file,
|
|
158
|
+
dedicated_file
|
|
159
|
+
)
|
|
160
|
+
).to eq(result)
|
|
138
161
|
end
|
|
139
162
|
end
|
|
140
163
|
end
|
|
@@ -20,9 +20,9 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExpiresIn do
|
|
|
20
20
|
let(:file_name) { rand.to_s }
|
|
21
21
|
let(:output) { [file_name] }
|
|
22
22
|
let(:expected) { "Following files use expire_in instead of expires_in:\n\n#{file_name}\n" }
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
|
|
24
|
+
before { subject.instance_variable_set('@output', output) }
|
|
25
|
+
|
|
26
26
|
it { expect(subject.error_message).to eq expected }
|
|
27
27
|
end
|
|
28
28
|
end
|
|
@@ -38,12 +38,15 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExpiresIn do
|
|
|
38
38
|
|
|
39
39
|
describe '#excludes' do
|
|
40
40
|
context 'when expire_files_ignored is not set' do
|
|
41
|
-
let(:config)
|
|
41
|
+
let(:config) do
|
|
42
|
+
instance_double(
|
|
43
|
+
PolishGeeks::DevTools::Config,
|
|
44
|
+
expires_in_files_ignored: nil
|
|
45
|
+
)
|
|
46
|
+
end
|
|
42
47
|
|
|
43
48
|
before do
|
|
44
|
-
expect(PolishGeeks::DevTools)
|
|
45
|
-
.to receive(:config)
|
|
46
|
-
.and_return(config)
|
|
49
|
+
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
|
47
50
|
end
|
|
48
51
|
|
|
49
52
|
it { expect(subject.send(:excludes)).to eq [] }
|
|
@@ -52,15 +55,14 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExpiresIn do
|
|
|
52
55
|
context 'when expire_files_ignored is set' do
|
|
53
56
|
let(:expires_in_files_ignored) { rand }
|
|
54
57
|
let(:config) do
|
|
55
|
-
|
|
58
|
+
instance_double(
|
|
59
|
+
PolishGeeks::DevTools::Config,
|
|
56
60
|
expires_in_files_ignored: expires_in_files_ignored
|
|
57
61
|
)
|
|
58
62
|
end
|
|
59
63
|
|
|
60
64
|
before do
|
|
61
|
-
expect(PolishGeeks::DevTools)
|
|
62
|
-
.to receive(:config)
|
|
63
|
-
.and_return(config)
|
|
65
|
+
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
|
64
66
|
end
|
|
65
67
|
|
|
66
68
|
it { expect(subject.send(:excludes)).to eq expires_in_files_ignored }
|
|
@@ -135,24 +135,32 @@ RSpec.describe PolishGeeks::DevTools::Commands::FinalBlankLine do
|
|
|
135
135
|
describe '#config_excludes' do
|
|
136
136
|
context 'final_blank_line_ignored is set' do
|
|
137
137
|
let(:paths) { [rand.to_s, rand.to_s] }
|
|
138
|
-
let(:config)
|
|
138
|
+
let(:config) do
|
|
139
|
+
instance_double(
|
|
140
|
+
PolishGeeks::DevTools::Config,
|
|
141
|
+
final_blank_line_ignored: paths
|
|
142
|
+
)
|
|
143
|
+
end
|
|
139
144
|
|
|
140
145
|
before do
|
|
141
|
-
expect(PolishGeeks::DevTools)
|
|
142
|
-
.to receive(:config)
|
|
143
|
-
.and_return config
|
|
146
|
+
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
|
144
147
|
end
|
|
145
148
|
|
|
146
149
|
it { expect(subject.send(:config_excludes)).to eq paths }
|
|
147
150
|
end
|
|
148
151
|
|
|
149
152
|
context 'final_blank_line_ignored is not set' do
|
|
150
|
-
let(:config)
|
|
153
|
+
let(:config) do
|
|
154
|
+
instance_double(
|
|
155
|
+
PolishGeeks::DevTools::Config,
|
|
156
|
+
final_blank_line_ignored: nil
|
|
157
|
+
)
|
|
158
|
+
end
|
|
159
|
+
|
|
151
160
|
before do
|
|
152
|
-
expect(PolishGeeks::DevTools)
|
|
153
|
-
.to receive(:config)
|
|
154
|
-
.and_return config
|
|
161
|
+
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
|
155
162
|
end
|
|
163
|
+
|
|
156
164
|
it { expect(subject.send(:config_excludes)).to eq [] }
|
|
157
165
|
end
|
|
158
166
|
end
|
|
@@ -9,15 +9,14 @@ RSpec.describe PolishGeeks::DevTools::Commands::RequiredFiles do
|
|
|
9
9
|
context 'when required_files_include is set' do
|
|
10
10
|
let(:required_files_include) { 'REVIEW.md' }
|
|
11
11
|
let(:config) do
|
|
12
|
-
|
|
12
|
+
instance_double(
|
|
13
|
+
PolishGeeks::DevTools::Config,
|
|
13
14
|
required_files_include: [required_files_include]
|
|
14
15
|
)
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
before do
|
|
18
|
-
expect(PolishGeeks::DevTools)
|
|
19
|
-
.to receive(:config)
|
|
20
|
-
.and_return(config)
|
|
19
|
+
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
|
21
20
|
subject.execute
|
|
22
21
|
end
|
|
23
22
|
|
|
@@ -39,13 +39,15 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
describe '#analyzed_files' do
|
|
42
|
-
let(:config)
|
|
42
|
+
let(:config) do
|
|
43
|
+
instance_double(
|
|
44
|
+
PolishGeeks::DevTools::Config,
|
|
45
|
+
rspec_files_structure_ignored: nil
|
|
46
|
+
)
|
|
47
|
+
end
|
|
43
48
|
|
|
44
49
|
before do
|
|
45
|
-
expect(PolishGeeks::DevTools)
|
|
46
|
-
.to receive(:config)
|
|
47
|
-
.and_return(config)
|
|
48
|
-
.at_least(:once)
|
|
50
|
+
expect(PolishGeeks::DevTools::Config).to receive(:config).at_least(:once) { config }
|
|
49
51
|
end
|
|
50
52
|
|
|
51
53
|
it { expect(subject.send(:analyzed_files)).not_to be_empty }
|
|
@@ -67,13 +69,15 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
|
67
69
|
end
|
|
68
70
|
|
|
69
71
|
describe '#analyzed_rspec_files' do
|
|
70
|
-
let(:config)
|
|
72
|
+
let(:config) do
|
|
73
|
+
instance_double(
|
|
74
|
+
PolishGeeks::DevTools::Config,
|
|
75
|
+
rspec_files_structure_ignored: nil
|
|
76
|
+
)
|
|
77
|
+
end
|
|
71
78
|
|
|
72
79
|
before do
|
|
73
|
-
expect(PolishGeeks::DevTools)
|
|
74
|
-
.to receive(:config)
|
|
75
|
-
.and_return(config)
|
|
76
|
-
.at_least(:once)
|
|
80
|
+
expect(PolishGeeks::DevTools::Config).to receive(:config).at_least(:once) { config }
|
|
77
81
|
end
|
|
78
82
|
|
|
79
83
|
it { expect(subject.send(:analyzed_rspec_files)).not_to be_empty }
|
|
@@ -120,12 +124,12 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
|
120
124
|
|
|
121
125
|
describe '#label' do
|
|
122
126
|
context 'when we run rspec_files_structure' do
|
|
123
|
-
let(:analyzed_files_result)
|
|
127
|
+
let(:analyzed_files_result) do
|
|
128
|
+
OpenStruct.new(count: rand(1000))
|
|
129
|
+
end
|
|
124
130
|
|
|
125
131
|
before do
|
|
126
|
-
expect(subject)
|
|
127
|
-
.to receive(:analyzed_files)
|
|
128
|
-
.and_return(analyzed_files_result)
|
|
132
|
+
expect(subject).to receive(:analyzed_files) { analyzed_files_result }
|
|
129
133
|
end
|
|
130
134
|
|
|
131
135
|
it 'returns the label' do
|
|
@@ -156,12 +160,15 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
|
156
160
|
|
|
157
161
|
describe '#excludes' do
|
|
158
162
|
context 'when rspec_files_structure_ignored is not set' do
|
|
159
|
-
let(:config)
|
|
163
|
+
let(:config) do
|
|
164
|
+
instance_double(
|
|
165
|
+
PolishGeeks::DevTools::Config,
|
|
166
|
+
rspec_files_structure_ignored: nil
|
|
167
|
+
)
|
|
168
|
+
end
|
|
160
169
|
|
|
161
170
|
before do
|
|
162
|
-
expect(PolishGeeks::DevTools)
|
|
163
|
-
.to receive(:config)
|
|
164
|
-
.and_return(config)
|
|
171
|
+
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
|
165
172
|
end
|
|
166
173
|
|
|
167
174
|
it { expect(subject.send(:excludes)).to eq [] }
|
|
@@ -170,15 +177,14 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
|
170
177
|
context 'when rspec_files_structure_ignored is set' do
|
|
171
178
|
let(:rspec_files_structure_ignored) { rand }
|
|
172
179
|
let(:config) do
|
|
173
|
-
|
|
180
|
+
instance_double(
|
|
181
|
+
PolishGeeks::DevTools::Config,
|
|
174
182
|
rspec_files_structure_ignored: rspec_files_structure_ignored
|
|
175
183
|
)
|
|
176
184
|
end
|
|
177
185
|
|
|
178
186
|
before do
|
|
179
|
-
expect(PolishGeeks::DevTools)
|
|
180
|
-
.to receive(:config)
|
|
181
|
-
.and_return(config)
|
|
187
|
+
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
|
182
188
|
end
|
|
183
189
|
|
|
184
190
|
it { expect(subject.send(:excludes)).to eq rspec_files_structure_ignored }
|
|
@@ -22,7 +22,8 @@ RSpec.describe PolishGeeks::DevTools::Commands::Rubocop do
|
|
|
22
22
|
let(:cmd) do
|
|
23
23
|
"bundle exec rubocop #{PolishGeeks::DevTools.app_root}" \
|
|
24
24
|
" -c #{subject.class.config_manager.path}" \
|
|
25
|
-
' --require rubocop-rspec'
|
|
25
|
+
' --require rubocop-rspec' \
|
|
26
|
+
' --display-cop-names'
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
before do
|
|
@@ -39,7 +40,8 @@ RSpec.describe PolishGeeks::DevTools::Commands::Rubocop do
|
|
|
39
40
|
let(:path) { Dir.pwd }
|
|
40
41
|
let(:cmd) do
|
|
41
42
|
"bundle exec rubocop #{PolishGeeks::DevTools.app_root} " \
|
|
42
|
-
"-c #{subject.class.config_manager.path}"
|
|
43
|
+
"-c #{subject.class.config_manager.path} " \
|
|
44
|
+
'--display-cop-names'
|
|
43
45
|
end
|
|
44
46
|
|
|
45
47
|
before do
|
|
@@ -7,9 +7,9 @@ RSpec.describe PolishGeeks::DevTools::Validators::Rubocop do
|
|
|
7
7
|
context 'false' do
|
|
8
8
|
context 'when Rubocop is enabled' do
|
|
9
9
|
before do
|
|
10
|
-
expect(PolishGeeks::DevTools::Config)
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
expect(PolishGeeks::DevTools::Config).to receive(:config).and_return(
|
|
11
|
+
instance_double(PolishGeeks::DevTools::Config, rubocop: false)
|
|
12
|
+
)
|
|
13
13
|
end
|
|
14
14
|
it { expect(subject.valid?).to be false }
|
|
15
15
|
end
|
|
@@ -18,9 +18,9 @@ RSpec.describe PolishGeeks::DevTools::Validators::Rubocop do
|
|
|
18
18
|
context 'true' do
|
|
19
19
|
context 'when Rubocop is disabled' do
|
|
20
20
|
before do
|
|
21
|
-
expect(PolishGeeks::DevTools::Config)
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
expect(PolishGeeks::DevTools::Config).to receive(:config).and_return(
|
|
22
|
+
instance_double(PolishGeeks::DevTools::Config, rubocop: true)
|
|
23
|
+
)
|
|
24
24
|
end
|
|
25
25
|
it { expect(subject.valid?).to be true }
|
|
26
26
|
end
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
RSpec.describe PolishGeeks::DevTools::Validators::Simplecov do
|
|
4
|
-
let(:output)
|
|
4
|
+
let(:output) do
|
|
5
|
+
OpenStruct.new(
|
|
6
|
+
rspec: '370 / 669 LOC (95.00%) covered'
|
|
7
|
+
)
|
|
8
|
+
end
|
|
5
9
|
subject { described_class.new(output) }
|
|
6
10
|
|
|
7
11
|
describe '#valid?' do
|
|
12
|
+
subject do
|
|
13
|
+
described_class.new(
|
|
14
|
+
OpenStruct.new(
|
|
15
|
+
rspec: 'output'
|
|
16
|
+
)
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
|
|
8
20
|
context 'false' do
|
|
9
|
-
subject { described_class.new(double(rspec: 'output')) }
|
|
10
21
|
context 'when SimpleCov not defined' do
|
|
11
22
|
before { allow(Object).to receive(:const_defined?) { false } }
|
|
12
23
|
it do
|
|
@@ -17,7 +28,6 @@ RSpec.describe PolishGeeks::DevTools::Validators::Simplecov do
|
|
|
17
28
|
end
|
|
18
29
|
|
|
19
30
|
context 'true' do
|
|
20
|
-
subject { described_class.new(double(rspec: 'output')) }
|
|
21
31
|
context 'when SimpleCov defined' do
|
|
22
32
|
before { allow(Object).to receive(:const_defined?) { true } }
|
|
23
33
|
it do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: polishgeeks-dev-tools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maciej Mensfeld
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-06-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -238,6 +238,7 @@ files:
|
|
|
238
238
|
- Rakefile
|
|
239
239
|
- config/haml-lint.yml
|
|
240
240
|
- config/rubocop.yml
|
|
241
|
+
- config/rubocop_rspec.yml
|
|
241
242
|
- config/rubocop_todo.yml
|
|
242
243
|
- config/yardopts
|
|
243
244
|
- lib/polish_geeks/dev_tools.rb
|