renuo-bin-check 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +33 -0
- data/.editorconfig +20 -0
- data/.gitignore +9 -0
- data/.reek +18 -0
- data/.rspec +2 -0
- data/.rubocop.yml +26 -0
- data/.ruby-version +1 -0
- data/.travis.yml +32 -0
- data/CHANGELOG.md +36 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/CONTRIBUTING.md +41 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +142 -0
- data/Rakefile +7 -0
- data/bin/check +66 -0
- data/bin/setup +61 -0
- data/lib/renuo-bin-check.rb +8 -0
- data/lib/renuo_bin_check/cacher.rb +46 -0
- data/lib/renuo_bin_check/default_scripts/default_rails.rb +160 -0
- data/lib/renuo_bin_check/initializer.rb +21 -0
- data/lib/renuo_bin_check/master_thread.rb +42 -0
- data/lib/renuo_bin_check/printer.rb +15 -0
- data/lib/renuo_bin_check/result.rb +10 -0
- data/lib/renuo_bin_check/script_config.rb +61 -0
- data/lib/renuo_bin_check/servant_thread.rb +43 -0
- data/lib/renuo_bin_check/version.rb +4 -0
- data/renuo-bin-check.gemspec +35 -0
- data/spec/code_climate.rb +0 -0
- data/spec/code_climate.travis.rb +4 -0
- data/spec/factories/cacher.rb +16 -0
- data/spec/factories/result.rb +29 -0
- data/spec/factories/script_config.rb +41 -0
- data/spec/integration/initializer_spec.rb +209 -0
- data/spec/renuo/bin-check/cacher_spec.rb +51 -0
- data/spec/renuo/bin-check/initializer_spec.rb +23 -0
- data/spec/renuo/bin-check/master_thread_spec.rb +46 -0
- data/spec/renuo/bin-check/printer_spec.rb +25 -0
- data/spec/renuo/bin-check/result_spec.rb +18 -0
- data/spec/renuo/bin-check/script_config_spec.rb +69 -0
- data/spec/renuo/bin-check/servant_thread_spec.rb +97 -0
- data/spec/spec-files/file1 +1 -0
- data/spec/spec-files/file2 +1 -0
- data/spec/spec-files/file2_copy +1 -0
- data/spec/spec-files/test_script_exit0 +5 -0
- data/spec/spec-files/test_script_exit1 +5 -0
- data/spec/spec-files/test_script_exit1_no_error_output +3 -0
- data/spec/spec-files/test_script_sleep1 +2 -0
- data/spec/spec-files/test_script_sleep2 +2 -0
- data/spec/spec_helper.rb +35 -0
- metadata +288 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'renuo_bin_check/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'renuo-bin-check'
|
8
|
+
spec.version = RenuoBinCheck::VERSION
|
9
|
+
spec.authors = ['Zora Fuchs']
|
10
|
+
spec.email = ['zora.fuchs@renuo.ch']
|
11
|
+
|
12
|
+
spec.summary = 'renuo-bin-check automates running programms to check code quality of a ruby application.'
|
13
|
+
spec.description = 'With this gem you can automatically check your code quality (e.g. before every commit). You can configure it to run rubocop, reek, rspec and even custom scripts. For faster runtime it makes use of cashing and parallel execution.'
|
14
|
+
spec.homepage = 'https://github.com/renuo/renuo-bin-check'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
|
23
|
+
spec.add_development_dependency 'awesome_print', '~> 1.7'
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
25
|
+
spec.add_development_dependency 'byebug', '~> 9.0'
|
26
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.5'
|
27
|
+
spec.add_development_dependency 'factory_girl', '~> 4.7'
|
28
|
+
spec.add_development_dependency 'pry', '~> 0.10'
|
29
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.3'
|
30
|
+
spec.add_development_dependency 'rubocop', '~> 0.40'
|
31
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
32
|
+
spec.add_development_dependency 'reek', '~> 4.0'
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.4'
|
34
|
+
spec.add_development_dependency 'simplecov', '~> 0.11'
|
35
|
+
end
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require './lib/renuo_bin_check/result'
|
2
|
+
FactoryGirl.define do
|
3
|
+
factory :cacher, class: RenuoBinCheck::Cacher do
|
4
|
+
command 'script_name'
|
5
|
+
paths ['./spec/spec-files/file1', './spec/spec-files/file2']
|
6
|
+
initialize_with { new(command, paths) }
|
7
|
+
|
8
|
+
factory :not_found_cacher do
|
9
|
+
command 'script_name2'
|
10
|
+
end
|
11
|
+
|
12
|
+
factory :copy_found_cacher do
|
13
|
+
paths ['./spec/spec-files/file1', './spec/spec-files/file2_copy']
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require './lib/renuo_bin_check/result'
|
2
|
+
FactoryGirl.define do
|
3
|
+
factory :result, class: RenuoBinCheck::Result do
|
4
|
+
standard_output "I passed\nThis is the second line\n"
|
5
|
+
error_output "I failed\nThis is the second line\n"
|
6
|
+
exit_code 0
|
7
|
+
initialize_with { new(standard_output, error_output, exit_code) }
|
8
|
+
|
9
|
+
factory :reversed_exit_result do
|
10
|
+
error_output "I passed\nThis is the second line\n"
|
11
|
+
standard_output "I failed\nThis is the second line\n"
|
12
|
+
exit_code 1
|
13
|
+
end
|
14
|
+
|
15
|
+
factory :overridden_output_result do
|
16
|
+
standard_output 'overridden standard_output'
|
17
|
+
error_output 'overridden error_output'
|
18
|
+
end
|
19
|
+
|
20
|
+
factory :appended_output_result do
|
21
|
+
standard_output "I passed\nThis is the second line\noverridden standard_output"
|
22
|
+
error_output "I failed\nThis is the second line\noverridden error_output"
|
23
|
+
end
|
24
|
+
|
25
|
+
factory :failed_result do
|
26
|
+
exit_code 1
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require './lib/renuo_bin_check/script_config'
|
2
|
+
FactoryGirl.define do
|
3
|
+
factory :script, class: RenuoBinCheck::ScriptConfig do
|
4
|
+
script_command 'cool command'
|
5
|
+
script_name 'script_name'
|
6
|
+
script_files %w(cool_file1 cool_file1)
|
7
|
+
|
8
|
+
factory :failing_script do
|
9
|
+
script_command './spec/spec-files/test_script_exit1'
|
10
|
+
script_name 'exit1'
|
11
|
+
end
|
12
|
+
|
13
|
+
factory :passing_script do
|
14
|
+
script_command './spec/spec-files/test_script_exit0'
|
15
|
+
script_name 'exit0'
|
16
|
+
|
17
|
+
factory :without_files_script do
|
18
|
+
script_files nil
|
19
|
+
end
|
20
|
+
|
21
|
+
factory :with_overridden_output_script do
|
22
|
+
script_standard_output 'overridden standard_output'
|
23
|
+
script_error_output 'overridden error_output'
|
24
|
+
end
|
25
|
+
|
26
|
+
factory :with_appended_output_script do
|
27
|
+
appended_standard_output 'overridden standard_output'
|
28
|
+
appended_error_output 'overridden error_output'
|
29
|
+
end
|
30
|
+
|
31
|
+
factory :reversed_exit_script do
|
32
|
+
script_reversed_exit true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
factory :cached_script do
|
37
|
+
script_command 'script_name'
|
38
|
+
script_files ['./spec/spec-files/file1', './spec/spec-files/file2']
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,209 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require './lib/renuo_bin_check/initializer'
|
3
|
+
|
4
|
+
RSpec.describe RenuoBinCheck::Initializer do
|
5
|
+
let(:bin_check) { RenuoBinCheck::Initializer.new }
|
6
|
+
|
7
|
+
context 'without caching' do
|
8
|
+
it 'returns exit-code 0 and expected output' do
|
9
|
+
bin_check.check do |config|
|
10
|
+
config.command './spec/spec-files/test_script_exit0'
|
11
|
+
end
|
12
|
+
expect do
|
13
|
+
begin
|
14
|
+
bin_check.run
|
15
|
+
rescue SystemExit => se
|
16
|
+
expect(se.status).to eq(0)
|
17
|
+
end
|
18
|
+
end.to output("I passed\nThis is the second line\n").to_stdout
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns exit-code 0 and expected output' do
|
22
|
+
bin_check.check do |config|
|
23
|
+
config.command 'echo hello'
|
24
|
+
end
|
25
|
+
expect do
|
26
|
+
begin
|
27
|
+
bin_check.run
|
28
|
+
rescue SystemExit => se
|
29
|
+
expect(se.status).to eq(0)
|
30
|
+
end
|
31
|
+
end.to output("hello\n").to_stdout
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'returns exit-code 0 and expected overridden output' do
|
35
|
+
bin_check.check do |config|
|
36
|
+
config.command 'echo hello'
|
37
|
+
config.success_message 'I passed :)'
|
38
|
+
end
|
39
|
+
expect do
|
40
|
+
begin
|
41
|
+
bin_check.run
|
42
|
+
rescue SystemExit => se
|
43
|
+
expect(se.status).to eq(0)
|
44
|
+
end
|
45
|
+
end.to output("I passed :)\n").to_stdout
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'returns exit-code 0 and expected appended output' do
|
49
|
+
bin_check.check do |config|
|
50
|
+
config.command 'echo hello'
|
51
|
+
config.success_message '+I passed :)'
|
52
|
+
end
|
53
|
+
expect do
|
54
|
+
begin
|
55
|
+
bin_check.run
|
56
|
+
rescue SystemExit => se
|
57
|
+
expect(se.status).to eq(0)
|
58
|
+
end
|
59
|
+
end.to output("hello\nI passed :)\n").to_stdout
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'returns exit-code 1 and expected error-output' do
|
63
|
+
bin_check.check do |config|
|
64
|
+
config.command './spec/spec-files/test_script_exit1'
|
65
|
+
end
|
66
|
+
expect do
|
67
|
+
begin
|
68
|
+
bin_check.run
|
69
|
+
rescue SystemExit => se
|
70
|
+
expect(se.status).to eq(1)
|
71
|
+
end
|
72
|
+
end.to output("I failed\nThis is the second line\n").to_stderr
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'returns exit-code 1 and expected non-error-output' do
|
76
|
+
bin_check.check do |config|
|
77
|
+
config.command './spec/spec-files/test_script_exit1_no_error_output'
|
78
|
+
end
|
79
|
+
expect do
|
80
|
+
begin
|
81
|
+
bin_check.run
|
82
|
+
rescue SystemExit => se
|
83
|
+
expect(se.status).to eq(1)
|
84
|
+
end
|
85
|
+
end.to output("I failed\nThis is the second line\n").to_stderr
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'returns exit-code 1 and expected overridden error-output' do
|
89
|
+
bin_check.check do |config|
|
90
|
+
config.command './spec/spec-files/test_script_exit1'
|
91
|
+
config.error_message 'it failed...'
|
92
|
+
end
|
93
|
+
expect do
|
94
|
+
begin
|
95
|
+
bin_check.run
|
96
|
+
rescue SystemExit => se
|
97
|
+
expect(se.status).to eq(1)
|
98
|
+
end
|
99
|
+
end.to output("it failed...\n").to_stderr
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'returns exit-code 1 and expected appended error-output' do
|
103
|
+
bin_check.check do |config|
|
104
|
+
config.command './spec/spec-files/test_script_exit1'
|
105
|
+
config.error_message '+it failed...'
|
106
|
+
end
|
107
|
+
expect do
|
108
|
+
begin
|
109
|
+
bin_check.run
|
110
|
+
rescue SystemExit => se
|
111
|
+
expect(se.status).to eq(1)
|
112
|
+
end
|
113
|
+
end.to output("I failed\nThis is the second line\nit failed...\n").to_stderr
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'runns scripts parallel' do
|
117
|
+
start_time = Time.now
|
118
|
+
bin_check.check { |config| config.command './spec/spec-files/test_script_sleep1' }
|
119
|
+
bin_check.check { |config| config.command './spec/spec-files/test_script_sleep2' }
|
120
|
+
begin
|
121
|
+
bin_check.run
|
122
|
+
rescue SystemExit => se
|
123
|
+
expect(se.status).to eq(0)
|
124
|
+
end
|
125
|
+
end_time = Time.now
|
126
|
+
expect(end_time - start_time).to be_within(0.4).of(2)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
context 'cached script' do
|
131
|
+
before(:each) do
|
132
|
+
FileUtils.mkdir_p 'tmp/bin-check/exit0/df57ab93c06ded11a01f2de950307019'
|
133
|
+
File.write 'tmp/bin-check/exit0/df57ab93c06ded11a01f2de950307019/standard_output',
|
134
|
+
"I'm cached\npassed\n"
|
135
|
+
File.write 'tmp/bin-check/exit0/df57ab93c06ded11a01f2de950307019/error_output',
|
136
|
+
"I'm cached\npassed\n"
|
137
|
+
File.write 'tmp/bin-check/exit0/df57ab93c06ded11a01f2de950307019/exit_code', 0
|
138
|
+
end
|
139
|
+
|
140
|
+
after(:each) { FileUtils.remove_dir('./tmp/bin-check') }
|
141
|
+
|
142
|
+
it 'returns cached output and exit-code' do
|
143
|
+
bin_check.check do |config|
|
144
|
+
config.command './spec/spec-files/test_script_exit0'
|
145
|
+
config.files %w(./spec/spec-files/file1 ./spec/spec-files/file2)
|
146
|
+
config.name 'exit0'
|
147
|
+
end
|
148
|
+
expect do
|
149
|
+
begin
|
150
|
+
bin_check.run
|
151
|
+
rescue SystemExit => se
|
152
|
+
expect(se.status).to eq(0)
|
153
|
+
end
|
154
|
+
end.to output("I'm cached\npassed\n").to_stdout
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
context 'saving to exit0 folder' do
|
159
|
+
after(:each) { FileUtils.remove_dir('./tmp/bin-check') }
|
160
|
+
|
161
|
+
it 'saves output and exit-code to files in folder named by given name' do
|
162
|
+
bin_check.check do |config|
|
163
|
+
config.command './spec/spec-files/test_script_exit0'
|
164
|
+
config.files %w(./spec/spec-files/file1 ./spec/spec-files/file2)
|
165
|
+
config.name 'exit0'
|
166
|
+
end
|
167
|
+
expect do
|
168
|
+
begin
|
169
|
+
bin_check.run
|
170
|
+
rescue SystemExit => se
|
171
|
+
expect(se.status).to eq(0)
|
172
|
+
end
|
173
|
+
end.to output("I passed\nThis is the second line\n").to_stdout
|
174
|
+
|
175
|
+
expect(File.read('./tmp/bin-check/exit0/df57ab93c06ded11a01f2de950307019/error_output'))
|
176
|
+
.to eq("I failed\nThis is the second line\n")
|
177
|
+
expect(File.read('./tmp/bin-check/exit0/df57ab93c06ded11a01f2de950307019/standard_output'))
|
178
|
+
.to eq("I passed\nThis is the second line\n")
|
179
|
+
expect(File.read('./tmp/bin-check/exit0/df57ab93c06ded11a01f2de950307019/exit_code').to_i).to eq(0)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
context 'saving to 65a98809d7447e9857b9acf1fbc89dcc folder' do
|
184
|
+
after(:each) { FileUtils.remove_dir('./tmp/bin-check') }
|
185
|
+
|
186
|
+
it 'saves output and exit-code to files in folder named by hashed command' do
|
187
|
+
bin_check.check do |config|
|
188
|
+
config.command './spec/spec-files/test_script_exit0'
|
189
|
+
config.files %w(./spec/spec-files/file1 ./spec/spec-files/file2)
|
190
|
+
end
|
191
|
+
expect do
|
192
|
+
begin
|
193
|
+
bin_check.run
|
194
|
+
rescue SystemExit => se
|
195
|
+
expect(se.status).to eq(0)
|
196
|
+
end
|
197
|
+
end.to output("I passed\nThis is the second line\n").to_stdout
|
198
|
+
|
199
|
+
expect(File.read('./tmp/bin-check/65a98809d7447e9857b9acf1fbc89dcc/'\
|
200
|
+
'df57ab93c06ded11a01f2de950307019/error_output'))
|
201
|
+
.to eq("I failed\nThis is the second line\n")
|
202
|
+
expect(File.read('./tmp/bin-check/65a98809d7447e9857b9acf1fbc89dcc/'\
|
203
|
+
'df57ab93c06ded11a01f2de950307019/standard_output'))
|
204
|
+
.to eq("I passed\nThis is the second line\n")
|
205
|
+
expect(File.read('./tmp/bin-check/65a98809d7447e9857b9acf1fbc89dcc/df57ab93c06ded11a01f2de950307019/exit_code')
|
206
|
+
.to_i).to eq(0)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require './lib/renuo_bin_check/cacher'
|
3
|
+
|
4
|
+
RSpec.describe RenuoBinCheck::Cacher do
|
5
|
+
let(:result_attributes) { attributes_for(:result) }
|
6
|
+
let(:result) { build(:result) }
|
7
|
+
let(:cacher) { build(:cacher) }
|
8
|
+
|
9
|
+
context 'results are cashed' do
|
10
|
+
before(:each) do
|
11
|
+
FileUtils.mkdir_p 'tmp/bin-check/script_name/df57ab93c06ded11a01f2de950307019'
|
12
|
+
File.write 'tmp/bin-check/script_name/df57ab93c06ded11a01f2de950307019/standard_output',
|
13
|
+
"I passed\nThis is the second line\n"
|
14
|
+
File.write 'tmp/bin-check/script_name/df57ab93c06ded11a01f2de950307019/error_output',
|
15
|
+
"I failed\nThis is the second line\n"
|
16
|
+
File.write 'tmp/bin-check/script_name/df57ab93c06ded11a01f2de950307019/exit_code', 0
|
17
|
+
end
|
18
|
+
|
19
|
+
after(:each) { FileUtils.remove_dir('./tmp/bin-check') }
|
20
|
+
|
21
|
+
it 'returns result' do
|
22
|
+
expect(cacher.result).to have_attributes(result_attributes)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'recognizes different file names' do
|
26
|
+
cacher = build(:copy_found_cacher)
|
27
|
+
expect(cacher.exists?).to be_falsey
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'cashes do not exist' do
|
32
|
+
let(:cacher) { build(:not_found_cacher) }
|
33
|
+
it 'returns new hash' do
|
34
|
+
expect(cacher.exists?).to be_falsey
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'save results' do
|
39
|
+
after(:each) { FileUtils.remove_dir('./tmp/bin-check') }
|
40
|
+
|
41
|
+
it 'saves result to files' do
|
42
|
+
cacher.cache(result)
|
43
|
+
expect(File.read('./tmp/bin-check/script_name/df57ab93c06ded11a01f2de950307019/error_output'))
|
44
|
+
.to eq(result.error_output)
|
45
|
+
expect(File.read('./tmp/bin-check/script_name/df57ab93c06ded11a01f2de950307019/standard_output'))
|
46
|
+
.to eq(result.standard_output)
|
47
|
+
expect(File.read('./tmp/bin-check/script_name/df57ab93c06ded11a01f2de950307019/exit_code').to_i)
|
48
|
+
.to eq(result.exit_code)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require './lib/renuo_bin_check/initializer'
|
3
|
+
|
4
|
+
RSpec.describe RenuoBinCheck::Initializer do
|
5
|
+
let(:bin_check) { RenuoBinCheck::Initializer.new }
|
6
|
+
|
7
|
+
it 'creates a MasterThread when it is initialized' do
|
8
|
+
expect(bin_check.master_thread.class).to eq(RenuoBinCheck::MasterThread)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'creates ScriptConfig and adds it to runner' do
|
12
|
+
bin_check.check do |config|
|
13
|
+
config.command 'blubb'
|
14
|
+
config.files %w(file1 file2)
|
15
|
+
end
|
16
|
+
expect(bin_check.master_thread.threads.last.class).to eq(Thread)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'makes runner handle the threads' do
|
20
|
+
expect(bin_check.master_thread).to receive(:finalize)
|
21
|
+
bin_check.run
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require './lib/renuo_bin_check/master_thread'
|
3
|
+
|
4
|
+
RSpec.describe RenuoBinCheck::MasterThread do
|
5
|
+
let(:script) { build :script }
|
6
|
+
let(:printer) { RenuoBinCheck::Printer.new }
|
7
|
+
let(:master) { RenuoBinCheck::MasterThread.new(printer) }
|
8
|
+
|
9
|
+
it 'should add a serventThread when add_thread is called' do
|
10
|
+
master.add_thread(script)
|
11
|
+
expect(master.threads.size).to eq(1)
|
12
|
+
expect(master.threads.first.class).to eq(Thread)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'initializes the instance variable threads as empty array' do
|
16
|
+
expect(master.threads.empty?).to be_truthy
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'one script fails' do
|
20
|
+
after(:each) { FileUtils.remove_dir('./tmp/bin-check') }
|
21
|
+
it 'exits with exit code 1' do
|
22
|
+
master.add_thread(build(:passing_script))
|
23
|
+
master.add_thread(build(:failing_script))
|
24
|
+
expect(master.printer).to receive(:print_error_output)
|
25
|
+
begin
|
26
|
+
master.finalize
|
27
|
+
rescue SystemExit => se
|
28
|
+
expect(se.status).to eq(1)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'all scripts pass' do
|
34
|
+
after(:each) { FileUtils.remove_dir('./tmp/bin-check') }
|
35
|
+
it 'exits with exit code 0' do
|
36
|
+
master.add_thread(build(:passing_script))
|
37
|
+
master.add_thread(build(:passing_script))
|
38
|
+
expect(master.printer).to receive(:print_standard_output)
|
39
|
+
begin
|
40
|
+
master.finalize
|
41
|
+
rescue SystemExit => se
|
42
|
+
expect(se.status).to eq(0)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|