polishgeeks-dev-tools 1.3.2 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- 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::ExamplesComparator do
|
4
|
-
subject { described_class.new }
|
4
|
+
subject(:examples_comparator) { described_class.new }
|
5
5
|
|
6
6
|
let(:example_file) { rand.to_s }
|
7
7
|
let(:dedicated_file) { example_file }
|
@@ -11,7 +11,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
11
11
|
let(:config_path) { rand.to_s }
|
12
12
|
|
13
13
|
before do
|
14
|
-
expect(
|
14
|
+
expect(examples_comparator)
|
15
15
|
.to receive(:config_path)
|
16
16
|
.and_return(config_path)
|
17
17
|
|
@@ -30,15 +30,15 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
30
30
|
let(:compare_result) { true }
|
31
31
|
|
32
32
|
before do
|
33
|
-
expect(
|
33
|
+
expect(examples_comparator)
|
34
34
|
.to receive(:same_key_structure?)
|
35
35
|
.and_return(compare_result)
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'puts a successful message into output' do
|
39
|
-
|
39
|
+
examples_comparator.execute
|
40
40
|
|
41
|
-
expect(
|
41
|
+
expect(examples_comparator.output).to include 'success'
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -46,14 +46,14 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
46
46
|
let(:compare_result) { false }
|
47
47
|
|
48
48
|
before do
|
49
|
-
expect(
|
49
|
+
expect(examples_comparator)
|
50
50
|
.to receive(:same_key_structure?)
|
51
51
|
.and_return(compare_result)
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'puts a failed message into output' do
|
55
|
-
|
56
|
-
expect(
|
55
|
+
examples_comparator.execute
|
56
|
+
expect(examples_comparator.output).to include 'failed'
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -61,8 +61,8 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
61
61
|
let(:dedicated_file_present) { false }
|
62
62
|
|
63
63
|
it 'puts a failed message into output' do
|
64
|
-
|
65
|
-
expect(
|
64
|
+
examples_comparator.execute
|
65
|
+
expect(examples_comparator.output).to include 'file is missing'
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -73,7 +73,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'is equal to expected message' do
|
76
|
-
expect(
|
76
|
+
expect(examples_comparator.send(:config_path)).to eq expected
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -82,7 +82,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
82
82
|
let(:expected) { "\e[32m success\e[0m - #{compare_header}\n" }
|
83
83
|
|
84
84
|
it 'is equal to expected message' do
|
85
|
-
expect(
|
85
|
+
expect(examples_comparator.send(:successful_compare, compare_header)).to eq expected
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -91,7 +91,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
91
91
|
let(:expected) { "\e[31m failed\e[0m - #{compare_header} - structure not equal\n" }
|
92
92
|
|
93
93
|
it 'is equal to expected message' do
|
94
|
-
expect(
|
94
|
+
expect(examples_comparator.send(:failed_compare, compare_header)).to eq expected
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -99,7 +99,9 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
99
99
|
let(:expected) { "#{File.basename(example_file)} and #{File.basename(dedicated_file)}" }
|
100
100
|
|
101
101
|
it 'is equal to expected message' do
|
102
|
-
expect(
|
102
|
+
expect(
|
103
|
+
examples_comparator.send(:compare_header, example_file, dedicated_file)
|
104
|
+
).to eq expected
|
103
105
|
end
|
104
106
|
end
|
105
107
|
|
@@ -138,7 +140,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
138
140
|
|
139
141
|
it do
|
140
142
|
expect(
|
141
|
-
|
143
|
+
examples_comparator.send(
|
142
144
|
:same_key_structure?,
|
143
145
|
example_file,
|
144
146
|
dedicated_file
|
@@ -152,7 +154,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
152
154
|
|
153
155
|
it do
|
154
156
|
expect(
|
155
|
-
|
157
|
+
examples_comparator.send(
|
156
158
|
:same_key_structure?,
|
157
159
|
example_file,
|
158
160
|
dedicated_file
|
@@ -165,22 +167,18 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExamplesComparator do
|
|
165
167
|
describe '#valid?' do
|
166
168
|
context 'when example files have the same structure' do
|
167
169
|
before do
|
168
|
-
|
170
|
+
examples_comparator.instance_variable_set(:@output, 'OK')
|
169
171
|
end
|
170
172
|
|
171
|
-
it
|
172
|
-
expect(subject.valid?).to eq true
|
173
|
-
end
|
173
|
+
it { expect(examples_comparator.valid?).to eq true }
|
174
174
|
end
|
175
175
|
|
176
176
|
context 'when example files do not have the same structure' do
|
177
177
|
before do
|
178
|
-
|
178
|
+
examples_comparator.instance_variable_set(:@output, 'failed')
|
179
179
|
end
|
180
180
|
|
181
|
-
it
|
182
|
-
expect(subject.valid?).to eq false
|
183
|
-
end
|
181
|
+
it { expect(examples_comparator.valid?).to eq false }
|
184
182
|
end
|
185
183
|
end
|
186
184
|
|
@@ -1,18 +1,16 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe PolishGeeks::DevTools::Commands::ExpiresIn do
|
4
|
-
subject { described_class.new }
|
4
|
+
subject(:expires_in) { described_class.new }
|
5
5
|
|
6
6
|
let(:config) { double }
|
7
7
|
|
8
8
|
describe '#execute' do
|
9
|
-
it
|
10
|
-
subject.execute
|
11
|
-
end
|
9
|
+
it { expires_in.execute }
|
12
10
|
end
|
13
11
|
|
14
12
|
describe '#label' do
|
15
|
-
it { expect(
|
13
|
+
it { expect(expires_in.label).to eq 'Expires in' }
|
16
14
|
end
|
17
15
|
|
18
16
|
describe '#error_message' do
|
@@ -21,18 +19,18 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExpiresIn do
|
|
21
19
|
let(:output) { [file_name] }
|
22
20
|
let(:expected) { "Following files use expire_in instead of expires_in:\n\n#{file_name}\n" }
|
23
21
|
|
24
|
-
before {
|
22
|
+
before { expires_in.instance_variable_set('@output', output) }
|
25
23
|
|
26
|
-
it { expect(
|
24
|
+
it { expect(expires_in.error_message).to eq expected }
|
27
25
|
end
|
28
26
|
end
|
29
27
|
|
30
28
|
describe '#valid?' do
|
31
29
|
context 'when output is empty' do
|
32
30
|
before do
|
33
|
-
|
31
|
+
expires_in.instance_variable_set('@output', '')
|
34
32
|
end
|
35
|
-
it { expect(
|
33
|
+
it { expect(expires_in.valid?).to eq true }
|
36
34
|
end
|
37
35
|
end
|
38
36
|
|
@@ -49,7 +47,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExpiresIn do
|
|
49
47
|
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
50
48
|
end
|
51
49
|
|
52
|
-
it { expect(
|
50
|
+
it { expect(expires_in.send(:excludes)).to eq [] }
|
53
51
|
end
|
54
52
|
|
55
53
|
context 'when expire_files_ignored is set' do
|
@@ -65,7 +63,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::ExpiresIn do
|
|
65
63
|
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
66
64
|
end
|
67
65
|
|
68
|
-
it { expect(
|
66
|
+
it { expect(expires_in.send(:excludes)).to eq expires_in_files_ignored }
|
69
67
|
end
|
70
68
|
end
|
71
69
|
end
|
@@ -1,68 +1,64 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe PolishGeeks::DevTools::Commands::FinalBlankLine do
|
4
|
-
subject { described_class.new }
|
4
|
+
subject(:final_blank_line) { described_class.new }
|
5
5
|
|
6
6
|
describe '#execute' do
|
7
7
|
let(:files) { [rand.to_s, rand.to_s] }
|
8
8
|
|
9
9
|
before do
|
10
|
-
expect(
|
10
|
+
expect(final_blank_line)
|
11
11
|
.to receive(:files_to_analyze)
|
12
12
|
.and_return(files)
|
13
13
|
end
|
14
14
|
|
15
15
|
context 'when all files are valid' do
|
16
16
|
before do
|
17
|
-
expect(
|
17
|
+
expect(final_blank_line)
|
18
18
|
.to receive(:file_valid?)
|
19
19
|
.exactly(files.count).times
|
20
20
|
.and_return true
|
21
|
-
|
21
|
+
final_blank_line.execute
|
22
22
|
end
|
23
23
|
|
24
|
-
it
|
25
|
-
|
26
|
-
expect(subject.counter).to eq(files.count)
|
27
|
-
end
|
24
|
+
it { expect(final_blank_line.output).to eq [] }
|
25
|
+
it { expect(final_blank_line.counter).to eq(files.count) }
|
28
26
|
end
|
29
27
|
|
30
28
|
context 'when exist not valid file' do
|
31
29
|
before do
|
32
|
-
expect(
|
30
|
+
expect(final_blank_line)
|
33
31
|
.to receive(:file_valid?)
|
34
32
|
.exactly(files.count).times
|
35
33
|
.and_return false
|
36
34
|
|
37
35
|
files.each do |file|
|
38
|
-
expect(
|
36
|
+
expect(final_blank_line)
|
39
37
|
.to receive(:sanitize)
|
40
38
|
.with(file)
|
41
39
|
.and_return(file)
|
42
40
|
end
|
43
|
-
|
41
|
+
final_blank_line.execute
|
44
42
|
end
|
45
43
|
|
46
|
-
it
|
47
|
-
|
48
|
-
expect(subject.counter).to eq(files.count)
|
49
|
-
end
|
44
|
+
it { expect(final_blank_line.output).to eq files }
|
45
|
+
it { expect(final_blank_line.counter).to eq(files.count) }
|
50
46
|
end
|
51
47
|
end
|
52
48
|
|
53
49
|
describe '#valid?' do
|
54
50
|
before do
|
55
|
-
|
51
|
+
final_blank_line.instance_variable_set('@output', output)
|
56
52
|
end
|
57
53
|
|
58
54
|
context 'when output is empty' do
|
59
55
|
let(:output) { [] }
|
60
|
-
it { expect(
|
56
|
+
it { expect(final_blank_line.valid?).to eq true }
|
61
57
|
end
|
62
58
|
|
63
59
|
context 'when output have some files' do
|
64
60
|
let(:output) { ['file_name'] }
|
65
|
-
it { expect(
|
61
|
+
it { expect(final_blank_line.valid?).to eq false }
|
66
62
|
end
|
67
63
|
end
|
68
64
|
|
@@ -71,10 +67,10 @@ RSpec.describe PolishGeeks::DevTools::Commands::FinalBlankLine do
|
|
71
67
|
let(:expected) { "Final blank line: #{counter} files checked" }
|
72
68
|
|
73
69
|
before do
|
74
|
-
|
70
|
+
final_blank_line.instance_variable_set('@counter', counter)
|
75
71
|
end
|
76
72
|
|
77
|
-
it { expect(
|
73
|
+
it { expect(final_blank_line.label).to eq expected }
|
78
74
|
end
|
79
75
|
|
80
76
|
describe '#error_message' do
|
@@ -82,28 +78,28 @@ RSpec.describe PolishGeeks::DevTools::Commands::FinalBlankLine do
|
|
82
78
|
let(:expected) { "Following files don't have final blank line: \n#{output.join("\n")}\n" }
|
83
79
|
|
84
80
|
before do
|
85
|
-
|
81
|
+
final_blank_line.instance_variable_set('@output', output)
|
86
82
|
end
|
87
83
|
|
88
|
-
it { expect(
|
84
|
+
it { expect(final_blank_line.error_message).to eq expected }
|
89
85
|
end
|
90
86
|
|
91
87
|
describe '#files_to_analyze' do
|
92
88
|
let(:files) { [rand.to_s, rand.to_s] }
|
93
89
|
|
94
90
|
before do
|
95
|
-
expect(
|
91
|
+
expect(final_blank_line)
|
96
92
|
.to receive(:files_from_path)
|
97
93
|
.with('**/{*,.*}')
|
98
94
|
.and_return(files)
|
99
95
|
|
100
|
-
expect(
|
96
|
+
expect(final_blank_line)
|
101
97
|
.to receive(:remove_excludes)
|
102
98
|
.with(files)
|
103
99
|
.and_return(files)
|
104
100
|
end
|
105
101
|
|
106
|
-
it { expect(
|
102
|
+
it { expect(final_blank_line.send(:files_to_analyze)).to eq files }
|
107
103
|
end
|
108
104
|
|
109
105
|
describe '#remove_excludes' do
|
@@ -111,12 +107,12 @@ RSpec.describe PolishGeeks::DevTools::Commands::FinalBlankLine do
|
|
111
107
|
let(:excludes) { %w(lib exclude.txt) }
|
112
108
|
|
113
109
|
before do
|
114
|
-
expect(
|
110
|
+
expect(final_blank_line)
|
115
111
|
.to receive(:excludes)
|
116
112
|
.and_return(excludes)
|
117
113
|
end
|
118
114
|
|
119
|
-
it { expect(
|
115
|
+
it { expect(final_blank_line.send(:remove_excludes, files)).to eq ['file.rb'] }
|
120
116
|
end
|
121
117
|
|
122
118
|
describe '#excludes' do
|
@@ -124,12 +120,12 @@ RSpec.describe PolishGeeks::DevTools::Commands::FinalBlankLine do
|
|
124
120
|
let(:expected) { configs + described_class::DEFAULT_PATHS_TO_EXCLUDE }
|
125
121
|
|
126
122
|
before do
|
127
|
-
expect(
|
123
|
+
expect(final_blank_line)
|
128
124
|
.to receive(:config_excludes)
|
129
125
|
.and_return(configs)
|
130
126
|
end
|
131
127
|
|
132
|
-
it { expect(
|
128
|
+
it { expect(final_blank_line.send(:excludes)).to eq expected }
|
133
129
|
end
|
134
130
|
|
135
131
|
describe '#config_excludes' do
|
@@ -146,7 +142,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::FinalBlankLine do
|
|
146
142
|
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
147
143
|
end
|
148
144
|
|
149
|
-
it { expect(
|
145
|
+
it { expect(final_blank_line.send(:config_excludes)).to eq paths }
|
150
146
|
end
|
151
147
|
|
152
148
|
context 'final_blank_line_ignored is not set' do
|
@@ -161,7 +157,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::FinalBlankLine do
|
|
161
157
|
expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
|
162
158
|
end
|
163
159
|
|
164
|
-
it { expect(
|
160
|
+
it { expect(final_blank_line.send(:config_excludes)).to eq [] }
|
165
161
|
end
|
166
162
|
end
|
167
163
|
|
@@ -170,7 +166,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::FinalBlankLine do
|
|
170
166
|
let(:app_root) { PolishGeeks::DevTools.app_root }
|
171
167
|
let(:path) { "#{app_root}/#{file}" }
|
172
168
|
|
173
|
-
it { expect(
|
169
|
+
it { expect(final_blank_line.send(:sanitize, "#{app_root}/#{path}")).to eq file }
|
174
170
|
end
|
175
171
|
|
176
172
|
describe '#file_valid?' do
|
@@ -192,7 +188,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::FinalBlankLine do
|
|
192
188
|
.and_return([rand.to_s + "\n"])
|
193
189
|
end
|
194
190
|
|
195
|
-
it { expect(
|
191
|
+
it { expect(final_blank_line.send(:file_valid?, file)).to eq true }
|
196
192
|
end
|
197
193
|
|
198
194
|
context 'file does not have final blank line' do
|
@@ -203,7 +199,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::FinalBlankLine do
|
|
203
199
|
.and_return([rand.to_s + 'end'])
|
204
200
|
end
|
205
201
|
|
206
|
-
it { expect(
|
202
|
+
it { expect(final_blank_line.send(:file_valid?, file)).to eq false }
|
207
203
|
end
|
208
204
|
end
|
209
205
|
|
@@ -214,7 +210,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::FinalBlankLine do
|
|
214
210
|
.with(file)
|
215
211
|
.and_return(0)
|
216
212
|
|
217
|
-
it { expect(
|
213
|
+
it { expect(final_blank_line.send(:file_valid?, file)).to eq true }
|
218
214
|
end
|
219
215
|
end
|
220
216
|
end
|
@@ -1,30 +1,30 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe PolishGeeks::DevTools::Commands::Gemfile do
|
4
|
-
subject { described_class.new }
|
4
|
+
subject(:gemfile) { described_class.new }
|
5
5
|
|
6
6
|
describe '#execute' do
|
7
7
|
let(:wrong_gem) { rand.to_s }
|
8
|
-
let(:
|
8
|
+
let(:gemfile_file) { double }
|
9
9
|
let(:output) { [rand.to_s] }
|
10
10
|
|
11
11
|
before do
|
12
12
|
expect(File)
|
13
13
|
.to receive(:join)
|
14
14
|
.with(::PolishGeeks::DevTools.app_root, 'Gemfile')
|
15
|
-
.and_return(
|
15
|
+
.and_return(gemfile_file)
|
16
16
|
end
|
17
17
|
|
18
18
|
context 'gemfile file exists' do
|
19
19
|
before do
|
20
20
|
expect(File)
|
21
21
|
.to receive(:exist?)
|
22
|
-
.with(
|
22
|
+
.with(gemfile_file)
|
23
23
|
.and_return(true)
|
24
24
|
|
25
25
|
expect(IO)
|
26
26
|
.to receive(:readlines)
|
27
|
-
.with(
|
27
|
+
.with(gemfile_file)
|
28
28
|
.and_return([wrong_gem])
|
29
29
|
|
30
30
|
expect(wrong_gem)
|
@@ -34,8 +34,8 @@ RSpec.describe PolishGeeks::DevTools::Commands::Gemfile do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'set wrong gems to output' do
|
37
|
-
|
38
|
-
expect(
|
37
|
+
gemfile.execute
|
38
|
+
expect(gemfile.output).to eq [wrong_gem]
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -43,30 +43,30 @@ RSpec.describe PolishGeeks::DevTools::Commands::Gemfile do
|
|
43
43
|
before do
|
44
44
|
expect(File)
|
45
45
|
.to receive(:exist?)
|
46
|
-
.with(
|
46
|
+
.with(gemfile_file)
|
47
47
|
.and_return(false)
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'set empty array to output' do
|
51
|
-
|
52
|
-
expect(
|
51
|
+
gemfile.execute
|
52
|
+
expect(gemfile.output).to eq []
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
describe '#label' do
|
58
|
-
it { expect(
|
58
|
+
it { expect(gemfile.label).to eq 'Gemfile checking' }
|
59
59
|
end
|
60
60
|
|
61
61
|
describe '#error_message' do
|
62
62
|
let(:output) { [rand.to_s, rand.to_s] }
|
63
63
|
|
64
64
|
before do
|
65
|
-
|
65
|
+
gemfile.instance_variable_set('@output', output)
|
66
66
|
end
|
67
67
|
|
68
68
|
it 'contains output with wrong gems' do
|
69
|
-
expect(
|
69
|
+
expect(gemfile.error_message)
|
70
70
|
.to eq "Gemfile contains gems from local path: \n#{output.join('')}"
|
71
71
|
end
|
72
72
|
end
|
@@ -74,18 +74,18 @@ RSpec.describe PolishGeeks::DevTools::Commands::Gemfile do
|
|
74
74
|
describe '#valid?' do
|
75
75
|
context 'when output is empty' do
|
76
76
|
before do
|
77
|
-
|
77
|
+
gemfile.instance_variable_set('@output', [])
|
78
78
|
end
|
79
79
|
|
80
|
-
it { expect(
|
80
|
+
it { expect(gemfile.valid?).to be true }
|
81
81
|
end
|
82
82
|
|
83
83
|
context 'when output is not empty' do
|
84
84
|
before do
|
85
|
-
|
85
|
+
gemfile.instance_variable_set('@output', [rand.to_s])
|
86
86
|
end
|
87
87
|
|
88
|
-
it { expect(
|
88
|
+
it { expect(gemfile.valid?).to be false }
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|