specbandit 0.4.0 → 0.5.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/lib/specbandit/version.rb +1 -1
- data/lib/specbandit/worker.rb +29 -4
- 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: dd0cef232a7dfa2dd4109d150bd63dbdaac27f65c87e9a9c4a8c495678fdc8f0
|
|
4
|
+
data.tar.gz: c0a7505268abdc305f6d095fd75788ee5180c4e911972af8f95397bb57241358
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 93c598ec5a9e0a542c0f86159ba3a70f7d7712b4c7f1c0bdf264cd9316363b483470986af3f6b619d326a52ce6d14cbd4c3ffff91e681d8c7eb7ddb8f1a2e150
|
|
7
|
+
data.tar.gz: 7974be5fd63f662d6db8a3b99cf00aeb7a0f75b0742c74a585c8cb7388686673507e2b23e0eb836cf1ec5c6b698585ef5eba0ec106b9436f6927409cbc59c85e
|
data/lib/specbandit/version.rb
CHANGED
data/lib/specbandit/worker.rb
CHANGED
|
@@ -116,10 +116,7 @@ module Specbandit
|
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
def run_rspec_batch(files)
|
|
119
|
-
|
|
120
|
-
# in the same process. This preserves configuration but resets
|
|
121
|
-
# the world (example groups, examples, shared groups, etc.).
|
|
122
|
-
RSpec.clear_examples
|
|
119
|
+
reset_rspec_state
|
|
123
120
|
|
|
124
121
|
args = files + rspec_opts
|
|
125
122
|
err = StringIO.new
|
|
@@ -134,5 +131,33 @@ module Specbandit
|
|
|
134
131
|
rspec_err = err&.string
|
|
135
132
|
output.print(rspec_err) unless rspec_err.nil? || rspec_err.empty?
|
|
136
133
|
end
|
|
134
|
+
|
|
135
|
+
# Reset RSpec state between batches so each batch runs cleanly.
|
|
136
|
+
#
|
|
137
|
+
# RSpec.clear_examples resets example groups, the reporter, filters, and
|
|
138
|
+
# the start-time clock -- but it leaves three critical pieces of state
|
|
139
|
+
# that cause cascading failures when running multiple batches in the
|
|
140
|
+
# same process:
|
|
141
|
+
#
|
|
142
|
+
# 1. output_stream -- After batch #1, Runner#configure sets
|
|
143
|
+
# output_stream to a StringIO. On batch #2+, the guard
|
|
144
|
+
# `if output_stream == $stdout` is permanently false, so the new
|
|
145
|
+
# `out` is never used. All RSpec output silently goes to the stale
|
|
146
|
+
# batch-1 StringIO.
|
|
147
|
+
#
|
|
148
|
+
# 2. wants_to_quit -- If any batch triggers a load error or fail-fast,
|
|
149
|
+
# this flag is set to true. On subsequent batches, Runner#setup
|
|
150
|
+
# returns immediately and Runner#run does exit_early -- specs are
|
|
151
|
+
# never loaded or run.
|
|
152
|
+
#
|
|
153
|
+
# 3. non_example_failure -- Once set, exit_code() unconditionally
|
|
154
|
+
# returns the failure exit code, even if all examples passed.
|
|
155
|
+
#
|
|
156
|
+
def reset_rspec_state
|
|
157
|
+
RSpec.clear_examples
|
|
158
|
+
RSpec.world.wants_to_quit = false
|
|
159
|
+
RSpec.world.non_example_failure = false
|
|
160
|
+
RSpec.configuration.output_stream = $stdout
|
|
161
|
+
end
|
|
137
162
|
end
|
|
138
163
|
end
|