polishgeeks-dev-tools 1.3.2 → 1.4.0
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/.ruby-version +1 -1
- data/.travis.yml +2 -3
- data/CHANGELOG.md +13 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +53 -55
- data/config/rubocop_rspec.yml +6 -0
- data/lib/polish_geeks/dev_tools/commands/base.rb +4 -4
- data/lib/polish_geeks/dev_tools/commands/brakeman.rb +1 -1
- data/lib/polish_geeks/dev_tools/commands/empty_methods/file_parser.rb +1 -1
- data/lib/polish_geeks/dev_tools/commands/final_blank_line.rb +3 -1
- data/lib/polish_geeks/dev_tools/commands/rubocop.rb +1 -1
- data/lib/polish_geeks/dev_tools/version.rb +1 -1
- data/lib/polishgeeks-dev-tools.rb +0 -1
- data/polishgeeks_dev_tools.gemspec +0 -1
- data/spec/lib/polish_geeks/dev_tools/commands/allowed_extensions_spec.rb +10 -10
- data/spec/lib/polish_geeks/dev_tools/commands/base_spec.rb +9 -9
- data/spec/lib/polish_geeks/dev_tools/commands/brakeman_spec.rb +15 -21
- data/spec/lib/polish_geeks/dev_tools/commands/bundler_audit_spec.rb +6 -6
- data/spec/lib/polish_geeks/dev_tools/commands/empty_methods/file_parser_spec.rb +18 -18
- data/spec/lib/polish_geeks/dev_tools/commands/empty_methods_spec.rb +29 -35
- data/spec/lib/polish_geeks/dev_tools/commands/examples_comparator_spec.rb +22 -24
- data/spec/lib/polish_geeks/dev_tools/commands/expires_in_spec.rb +9 -11
- data/spec/lib/polish_geeks/dev_tools/commands/final_blank_line_spec.rb +31 -35
- data/spec/lib/polish_geeks/dev_tools/commands/gemfile_spec.rb +17 -17
- data/spec/lib/polish_geeks/dev_tools/commands/haml_lint_spec.rb +7 -15
- data/spec/lib/polish_geeks/dev_tools/commands/required_files_spec.rb +8 -8
- data/spec/lib/polish_geeks/dev_tools/commands/rspec_files_names_spec.rb +19 -15
- data/spec/lib/polish_geeks/dev_tools/commands/rspec_files_structure_spec.rb +40 -44
- data/spec/lib/polish_geeks/dev_tools/commands/rspec_spec.rb +22 -22
- data/spec/lib/polish_geeks/dev_tools/commands/rubocop_spec.rb +21 -29
- data/spec/lib/polish_geeks/dev_tools/commands/rubycritic_spec.rb +2 -4
- data/spec/lib/polish_geeks/dev_tools/commands/simplecov_spec.rb +18 -28
- data/spec/lib/polish_geeks/dev_tools/commands/tasks_files_names_spec.rb +24 -25
- data/spec/lib/polish_geeks/dev_tools/commands/yard_spec.rb +10 -24
- data/spec/lib/polish_geeks/dev_tools/commands/yml_parser_spec.rb +15 -19
- data/spec/lib/polish_geeks/dev_tools/config_manager_spec.rb +33 -33
- data/spec/lib/polish_geeks/dev_tools/config_spec.rb +10 -10
- data/spec/lib/polish_geeks/dev_tools/errors_spec.rb +4 -4
- data/spec/lib/polish_geeks/dev_tools/hash_spec.rb +5 -5
- data/spec/lib/polish_geeks/dev_tools/logger_spec.rb +13 -13
- data/spec/lib/polish_geeks/dev_tools/output_storer_spec.rb +2 -2
- data/spec/lib/polish_geeks/dev_tools/runner_spec.rb +2 -2
- data/spec/lib/polish_geeks/dev_tools/shell_spec.rb +2 -2
- data/spec/lib/polish_geeks/dev_tools/validators/base_spec.rb +7 -7
- data/spec/lib/polish_geeks/dev_tools/validators/rails_spec.rb +3 -3
- data/spec/lib/polish_geeks/dev_tools/validators/rubocop_spec.rb +3 -3
- data/spec/lib/polish_geeks/dev_tools/validators/simplecov_spec.rb +12 -11
- data/spec/lib/polish_geeks/dev_tools/version_spec.rb +1 -3
- data/spec/lib/polish_geeks/dev_tools_spec.rb +7 -13
- metadata +3 -18
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe PolishGeeks::DevTools::Commands::HamlLint do
|
4
|
-
subject { described_class.new }
|
4
|
+
subject(:haml_lint) { described_class.new }
|
5
5
|
|
6
6
|
describe '#execute' do
|
7
7
|
let(:instance) { instance_double(PolishGeeks::DevTools::Shell) }
|
@@ -19,9 +19,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::HamlLint do
|
|
19
19
|
.with("bundle exec haml-lint -c #{path}.haml-lint.yml app/views")
|
20
20
|
end
|
21
21
|
|
22
|
-
it
|
23
|
-
subject.execute
|
24
|
-
end
|
22
|
+
it { haml_lint.execute }
|
25
23
|
end
|
26
24
|
|
27
25
|
context 'when app config does not exist' do
|
@@ -33,31 +31,25 @@ RSpec.describe PolishGeeks::DevTools::Commands::HamlLint do
|
|
33
31
|
.with("bundle exec haml-lint -c #{path}/config/haml-lint.yml app/views")
|
34
32
|
end
|
35
33
|
|
36
|
-
it
|
37
|
-
subject.execute
|
38
|
-
end
|
34
|
+
it { haml_lint.execute }
|
39
35
|
end
|
40
36
|
end
|
41
37
|
|
42
38
|
describe '#valid?' do
|
43
39
|
context 'when there are some issues' do
|
44
40
|
before do
|
45
|
-
|
41
|
+
haml_lint.instance_variable_set('@output', '[W] SpaceInsideHashAttributes')
|
46
42
|
end
|
47
43
|
|
48
|
-
it
|
49
|
-
expect(subject.valid?).to eq false
|
50
|
-
end
|
44
|
+
it { expect(haml_lint.valid?).to eq false }
|
51
45
|
end
|
52
46
|
|
53
47
|
context 'when there are no issues' do
|
54
48
|
before do
|
55
|
-
|
49
|
+
haml_lint.instance_variable_set('@output', '')
|
56
50
|
end
|
57
51
|
|
58
|
-
it
|
59
|
-
expect(subject.valid?).to eq true
|
60
|
-
end
|
52
|
+
it { expect(haml_lint.valid?).to eq true }
|
61
53
|
end
|
62
54
|
end
|
63
55
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe PolishGeeks::DevTools::Commands::RequiredFiles do
|
4
|
-
subject { described_class.new }
|
4
|
+
subject(:required_files) { described_class.new }
|
5
5
|
|
6
6
|
let(:config) { double }
|
7
7
|
|
@@ -17,22 +17,22 @@ RSpec.describe PolishGeeks::DevTools::Commands::RequiredFiles do
|
|
17
17
|
|
18
18
|
before do
|
19
19
|
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
20
|
-
|
20
|
+
required_files.execute
|
21
21
|
end
|
22
22
|
|
23
|
-
it { expect(
|
23
|
+
it { expect(required_files.error_message.match(/REVIEW.md not exist/)).not_to be_nil }
|
24
24
|
end
|
25
25
|
|
26
26
|
context 'when required_files_include is empty' do
|
27
|
-
it { expect(
|
27
|
+
it { expect(required_files.error_message).to be_nil }
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
describe '#valid?' do
|
32
32
|
context 'when file exist' do
|
33
|
-
before {
|
33
|
+
before { required_files.instance_variable_set('@output', []) }
|
34
34
|
|
35
|
-
it { expect(
|
35
|
+
it { expect(required_files.valid?).to be true }
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -42,9 +42,9 @@ RSpec.describe PolishGeeks::DevTools::Commands::RequiredFiles do
|
|
42
42
|
let(:output) { [file_name] }
|
43
43
|
let(:expected) { "Following files does not exist or are empty:\n#{file_name}\n" }
|
44
44
|
before do
|
45
|
-
|
45
|
+
required_files.instance_variable_set('@output', output)
|
46
46
|
end
|
47
|
-
it { expect(
|
47
|
+
it { expect(required_files.error_message).to eq expected }
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesNames do
|
4
|
-
subject { described_class.new }
|
4
|
+
subject(:rspec_files_names) { described_class.new }
|
5
5
|
|
6
6
|
let(:config) { double }
|
7
7
|
|
@@ -27,43 +27,47 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesNames do
|
|
27
27
|
.and_return(true)
|
28
28
|
.exactly(described_class::CHECKED_DIRS.count).times
|
29
29
|
|
30
|
-
|
30
|
+
rspec_files_names.execute
|
31
31
|
end
|
32
32
|
|
33
33
|
context 'when we dont have invalid files' do
|
34
34
|
let(:files) { ['test_spec.rb'] }
|
35
35
|
|
36
|
-
it
|
37
|
-
|
38
|
-
expect(
|
36
|
+
it { expect(rspec_files_names.output).to eq [] }
|
37
|
+
it do
|
38
|
+
expect(
|
39
|
+
rspec_files_names.counter
|
40
|
+
).to eq(described_class::CHECKED_DIRS.count * files.count)
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
44
|
context 'when we have invalid files' do
|
43
45
|
let(:files) { ['test_spe.rb'] }
|
44
46
|
|
45
|
-
it
|
46
|
-
|
47
|
-
expect(
|
47
|
+
it { expect(rspec_files_names.output).to eq(files * described_class::CHECKED_DIRS.count) }
|
48
|
+
it do
|
49
|
+
expect(
|
50
|
+
rspec_files_names.counter
|
51
|
+
).to eq(described_class::CHECKED_DIRS.count * files.count)
|
48
52
|
end
|
49
53
|
end
|
50
54
|
end
|
51
55
|
|
52
56
|
describe '#valid?' do
|
53
57
|
before do
|
54
|
-
|
58
|
+
rspec_files_names.instance_variable_set('@output', output)
|
55
59
|
end
|
56
60
|
|
57
61
|
context 'when output is empty' do
|
58
62
|
let(:output) { [] }
|
59
63
|
|
60
|
-
it { expect(
|
64
|
+
it { expect(rspec_files_names.valid?).to eq true }
|
61
65
|
end
|
62
66
|
|
63
67
|
context 'when output is not empty' do
|
64
68
|
let(:output) { ['file_name'] }
|
65
69
|
|
66
|
-
it { expect(
|
70
|
+
it { expect(rspec_files_names.valid?).to eq false }
|
67
71
|
end
|
68
72
|
end
|
69
73
|
|
@@ -72,10 +76,10 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesNames do
|
|
72
76
|
let(:expected) { "Rspec files names: #{counter} files checked" }
|
73
77
|
|
74
78
|
before do
|
75
|
-
|
79
|
+
rspec_files_names.instance_variable_set('@counter', counter)
|
76
80
|
end
|
77
81
|
|
78
|
-
it { expect(
|
82
|
+
it { expect(rspec_files_names.label).to eq expected }
|
79
83
|
end
|
80
84
|
|
81
85
|
describe '#error_message' do
|
@@ -83,9 +87,9 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesNames do
|
|
83
87
|
let(:expected) { "Following files have invalid name: \n #{output.join("\n")}\n" }
|
84
88
|
|
85
89
|
before do
|
86
|
-
|
90
|
+
rspec_files_names.instance_variable_set('@output', output)
|
87
91
|
end
|
88
92
|
|
89
|
-
it { expect(
|
93
|
+
it { expect(rspec_files_names.error_message).to eq expected }
|
90
94
|
end
|
91
95
|
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'tempfile'
|
3
3
|
|
4
4
|
RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
5
|
-
subject { described_class.new }
|
5
|
+
subject(:rspec_files_structure) { described_class.new }
|
6
6
|
|
7
7
|
describe '#execute' do
|
8
8
|
let(:analyzed_files_result) { double }
|
@@ -12,12 +12,12 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
12
12
|
let(:expected) { Hash(app: substract_result, rspec: substract_rspec_result) }
|
13
13
|
|
14
14
|
before do
|
15
|
-
expect(
|
15
|
+
expect(rspec_files_structure)
|
16
16
|
.to receive(:analyzed_files)
|
17
17
|
.twice
|
18
18
|
.and_return(analyzed_files_result)
|
19
19
|
|
20
|
-
expect(
|
20
|
+
expect(rspec_files_structure)
|
21
21
|
.to receive(:analyzed_rspec_files)
|
22
22
|
.exactly(2).times
|
23
23
|
.and_return(rspec_files_result)
|
@@ -29,12 +29,12 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
29
29
|
expect(rspec_files_result)
|
30
30
|
.to receive(:-)
|
31
31
|
.and_return(substract_rspec_result)
|
32
|
-
end
|
33
32
|
|
34
|
-
|
35
|
-
|
33
|
+
rspec_files_structure.execute
|
34
|
+
end
|
36
35
|
|
37
|
-
|
36
|
+
it do
|
37
|
+
expect(rspec_files_structure.instance_variable_get(:@output)).to eq expected
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -50,20 +50,21 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
50
50
|
expect(PolishGeeks::DevTools::Config).to receive(:config).at_least(:once) { config }
|
51
51
|
end
|
52
52
|
|
53
|
-
it { expect(
|
53
|
+
it { expect(rspec_files_structure.send(:analyzed_files)).not_to be_empty }
|
54
54
|
|
55
55
|
context 'when we gather files for analyze' do
|
56
56
|
let(:file) { Tempfile.new('tempfile') }
|
57
57
|
let(:files_collection) { [file] }
|
58
58
|
|
59
|
-
before
|
60
|
-
|
61
|
-
it 'flatten,s uniq and sanitize' do
|
59
|
+
before do
|
60
|
+
expect(rspec_files_structure).to receive(:checked_files) { files_collection }
|
62
61
|
expect(files_collection).to receive(:flatten!)
|
63
62
|
expect(files_collection).to receive(:uniq!)
|
64
|
-
expect(
|
63
|
+
expect(rspec_files_structure).to receive(:sanitize).with(file)
|
64
|
+
end
|
65
65
|
|
66
|
-
|
66
|
+
it 'flatten,s uniq and sanitize' do
|
67
|
+
rspec_files_structure.send(:analyzed_files)
|
67
68
|
end
|
68
69
|
end
|
69
70
|
end
|
@@ -80,45 +81,40 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
80
81
|
expect(PolishGeeks::DevTools::Config).to receive(:config).at_least(:once) { config }
|
81
82
|
end
|
82
83
|
|
83
|
-
it { expect(
|
84
|
+
it { expect(rspec_files_structure.send(:analyzed_rspec_files)).not_to be_empty }
|
84
85
|
|
85
86
|
context 'when we gather rspec files' do
|
86
87
|
let(:file) { double }
|
87
88
|
let(:files_collection) { [file] }
|
88
89
|
|
89
|
-
before
|
90
|
+
before do
|
91
|
+
expect(rspec_files_structure).to receive(:rspec_files) { files_collection }
|
92
|
+
expect(files_collection).to receive(:flatten!)
|
93
|
+
expect(files_collection).to receive(:uniq!)
|
94
|
+
expect(rspec_files_structure).to receive(:sanitize).with(file)
|
95
|
+
end
|
90
96
|
|
91
97
|
it 'flatten,s uniq and sanitize' do
|
92
|
-
|
93
|
-
.to receive(:flatten!)
|
94
|
-
|
95
|
-
expect(files_collection)
|
96
|
-
.to receive(:uniq!)
|
97
|
-
|
98
|
-
expect(subject)
|
99
|
-
.to receive(:sanitize)
|
100
|
-
.with(file)
|
101
|
-
|
102
|
-
subject.send(:analyzed_rspec_files)
|
98
|
+
rspec_files_structure.send(:analyzed_rspec_files)
|
103
99
|
end
|
104
100
|
end
|
105
101
|
end
|
106
102
|
|
107
103
|
describe '#valid?' do
|
108
104
|
before do
|
109
|
-
|
105
|
+
rspec_files_structure.instance_variable_set('@output', output)
|
110
106
|
end
|
111
107
|
|
112
108
|
context 'when output is empty' do
|
113
109
|
let(:output) { Hash(app: [], rspec: []) }
|
114
110
|
|
115
|
-
it { expect(
|
111
|
+
it { expect(rspec_files_structure.valid?).to eq true }
|
116
112
|
end
|
117
113
|
|
118
114
|
context 'when output is not empty' do
|
119
115
|
let(:output) { Hash(app: [double], rspec: [double]) }
|
120
116
|
|
121
|
-
it { expect(
|
117
|
+
it { expect(rspec_files_structure.valid?).to eq false }
|
122
118
|
end
|
123
119
|
end
|
124
120
|
|
@@ -129,12 +125,12 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
129
125
|
end
|
130
126
|
|
131
127
|
before do
|
132
|
-
expect(
|
128
|
+
expect(rspec_files_structure).to receive(:analyzed_files) { analyzed_files_result }
|
133
129
|
end
|
134
130
|
|
135
131
|
it 'returns the label' do
|
136
132
|
expected = "Rspec files structure (#{analyzed_files_result.count} checked)"
|
137
|
-
expect(
|
133
|
+
expect(rspec_files_structure.label).to eq expected
|
138
134
|
end
|
139
135
|
end
|
140
136
|
end
|
@@ -144,16 +140,16 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
144
140
|
let(:message) { rand.to_s }
|
145
141
|
let(:expected) { message + message }
|
146
142
|
before do
|
147
|
-
expect(
|
143
|
+
expect(rspec_files_structure)
|
148
144
|
.to receive(:files_error_message)
|
149
145
|
.and_return(message)
|
150
|
-
expect(
|
146
|
+
expect(rspec_files_structure)
|
151
147
|
.to receive(:rspec_error_message)
|
152
148
|
.and_return(message)
|
153
149
|
end
|
154
150
|
|
155
151
|
it 'returns the error message' do
|
156
|
-
expect(
|
152
|
+
expect(rspec_files_structure.error_message).to eq expected
|
157
153
|
end
|
158
154
|
end
|
159
155
|
end
|
@@ -171,7 +167,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
171
167
|
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
172
168
|
end
|
173
169
|
|
174
|
-
it { expect(
|
170
|
+
it { expect(rspec_files_structure.send(:excludes)).to eq [] }
|
175
171
|
end
|
176
172
|
|
177
173
|
context 'when rspec_files_structure_ignored is set' do
|
@@ -187,7 +183,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
187
183
|
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
188
184
|
end
|
189
185
|
|
190
|
-
it { expect(
|
186
|
+
it { expect(rspec_files_structure.send(:excludes)).to eq rspec_files_structure_ignored }
|
191
187
|
end
|
192
188
|
end
|
193
189
|
|
@@ -198,7 +194,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
198
194
|
let(:string) { "#{PolishGeeks::DevTools.app_root}/#{base}" }
|
199
195
|
|
200
196
|
it ' should be removed' do
|
201
|
-
expect(
|
197
|
+
expect(rspec_files_structure.send(:sanitize, string)).to eq base
|
202
198
|
end
|
203
199
|
end
|
204
200
|
|
@@ -206,7 +202,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
206
202
|
let(:string) { "#{base}_spec.rb" }
|
207
203
|
|
208
204
|
it ' should be removed' do
|
209
|
-
expect(
|
205
|
+
expect(rspec_files_structure.send(:sanitize, string)).to eq "#{base}.rb"
|
210
206
|
end
|
211
207
|
end
|
212
208
|
|
@@ -214,7 +210,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
214
210
|
let(:string) { "spec/#{base}" }
|
215
211
|
|
216
212
|
it ' should be removed' do
|
217
|
-
expect(
|
213
|
+
expect(rspec_files_structure.send(:sanitize, string)).to eq base
|
218
214
|
end
|
219
215
|
end
|
220
216
|
|
@@ -222,7 +218,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
222
218
|
let(:string) { "app/#{base}" }
|
223
219
|
|
224
220
|
it ' should be removed' do
|
225
|
-
expect(
|
221
|
+
expect(rspec_files_structure.send(:sanitize, string)).to eq base
|
226
222
|
end
|
227
223
|
end
|
228
224
|
end
|
@@ -231,11 +227,11 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
231
227
|
let(:output) { Hash(app: ['test.rb'], rspec: ['test_rspec.rb']) }
|
232
228
|
|
233
229
|
before do
|
234
|
-
|
230
|
+
rspec_files_structure.instance_variable_set(:@output, output)
|
235
231
|
end
|
236
232
|
|
237
233
|
it 'returns the error message' do
|
238
|
-
expect(
|
234
|
+
expect(rspec_files_structure.send(:files_error_message))
|
239
235
|
.to eq "Following files don't have corresponding Rspec files:\n\ntest.rb\n"
|
240
236
|
end
|
241
237
|
end
|
@@ -244,11 +240,11 @@ RSpec.describe PolishGeeks::DevTools::Commands::RspecFilesStructure do
|
|
244
240
|
let(:output) { Hash(app: ['test.rb'], rspec: ['test_rspec.rb']) }
|
245
241
|
|
246
242
|
before do
|
247
|
-
|
243
|
+
rspec_files_structure.instance_variable_set(:@output, output)
|
248
244
|
end
|
249
245
|
|
250
246
|
it 'returns the error message' do
|
251
|
-
expect(
|
247
|
+
expect(rspec_files_structure.send(:rspec_error_message))
|
252
248
|
.to eq "\n\nFollowing Rspec don't have corresponding files:\n\ntest_rspec_spec.rb\n"
|
253
249
|
end
|
254
250
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe PolishGeeks::DevTools::Commands::Rspec do
|
4
|
-
subject { described_class.new }
|
4
|
+
subject(:rspec) { described_class.new }
|
5
5
|
|
6
6
|
describe '#execute' do
|
7
7
|
let(:instance) { instance_double(PolishGeeks::DevTools::Shell) }
|
@@ -13,27 +13,27 @@ RSpec.describe PolishGeeks::DevTools::Commands::Rspec do
|
|
13
13
|
.with('bundle exec rspec spec')
|
14
14
|
end
|
15
15
|
|
16
|
-
it {
|
16
|
+
it { rspec.execute }
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
describe '#valid?' do
|
21
21
|
context 'when there is 1 failure' do
|
22
|
-
before {
|
22
|
+
before { rspec.instance_variable_set(:@output, '1 failure') }
|
23
23
|
|
24
|
-
it { expect(
|
24
|
+
it { expect(rspec.valid?).to eq false }
|
25
25
|
end
|
26
26
|
|
27
27
|
context 'when there are failures' do
|
28
|
-
before {
|
28
|
+
before { rspec.instance_variable_set(:@output, '2 failures') }
|
29
29
|
|
30
|
-
it { expect(
|
30
|
+
it { expect(rspec.valid?).to eq false }
|
31
31
|
end
|
32
32
|
|
33
33
|
context 'when there are no failures' do
|
34
|
-
before {
|
34
|
+
before { rspec.instance_variable_set(:@output, '0 failures') }
|
35
35
|
|
36
|
-
it { expect(
|
36
|
+
it { expect(rspec.valid?).to eq true }
|
37
37
|
end
|
38
38
|
|
39
39
|
context 'when there are no failures' do
|
@@ -43,10 +43,10 @@ RSpec.describe PolishGeeks::DevTools::Commands::Rspec do
|
|
43
43
|
before do
|
44
44
|
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
45
45
|
expect(config).to receive(:rspec_disallow_pending?) { false }
|
46
|
-
|
46
|
+
rspec.instance_variable_set(:@output, '0 failures, 2 pending')
|
47
47
|
end
|
48
48
|
|
49
|
-
it { expect(
|
49
|
+
it { expect(rspec.valid?).to eq true }
|
50
50
|
end
|
51
51
|
|
52
52
|
context 'and disallow pending true' do
|
@@ -57,18 +57,18 @@ RSpec.describe PolishGeeks::DevTools::Commands::Rspec do
|
|
57
57
|
|
58
58
|
context 'and there are pendings' do
|
59
59
|
before do
|
60
|
-
|
60
|
+
rspec.instance_variable_set(:@output, '0 failures, 2 pending')
|
61
61
|
end
|
62
62
|
|
63
|
-
it { expect(
|
63
|
+
it { expect(rspec.valid?).to eq false }
|
64
64
|
end
|
65
65
|
|
66
66
|
context 'and there are no pendings' do
|
67
67
|
before do
|
68
|
-
|
68
|
+
rspec.instance_variable_set(:@output, '0 failures, 0 pending')
|
69
69
|
end
|
70
70
|
|
71
|
-
it { expect(
|
71
|
+
it { expect(rspec.valid?).to eq true }
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -78,28 +78,28 @@ RSpec.describe PolishGeeks::DevTools::Commands::Rspec do
|
|
78
78
|
context 'when we run rspec' do
|
79
79
|
let(:label) { '10 examples, 5 failures, 2 pending' }
|
80
80
|
|
81
|
-
before {
|
81
|
+
before { rspec.instance_variable_set(:@output, label) }
|
82
82
|
|
83
|
-
it { expect(
|
83
|
+
it { expect(rspec.label).to eq 'Rspec (10 ex, 5 fa, 2 pe)' }
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
87
|
describe '#examples_count' do
|
88
|
-
before {
|
88
|
+
before { rspec.instance_variable_set(:@output, '10 examples') }
|
89
89
|
|
90
|
-
it { expect(
|
90
|
+
it { expect(rspec.send(:examples_count)).to eq(10) }
|
91
91
|
end
|
92
92
|
|
93
93
|
describe '#failures_count' do
|
94
|
-
before {
|
94
|
+
before { rspec.instance_variable_set(:@output, '10 failures') }
|
95
95
|
|
96
|
-
it { expect(
|
96
|
+
it { expect(rspec.send(:failures_count)).to eq(10) }
|
97
97
|
end
|
98
98
|
|
99
99
|
describe '#pending_count' do
|
100
|
-
before {
|
100
|
+
before { rspec.instance_variable_set(:@output, '10 pending') }
|
101
101
|
|
102
|
-
it { expect(
|
102
|
+
it { expect(rspec.send(:pending_count)).to eq(10) }
|
103
103
|
end
|
104
104
|
|
105
105
|
describe '.generator?' do
|