Class: OnceoverFormatterParallel
Constant Summary
OnceoverFormatter::COMPILATION_ERROR, OnceoverFormatter::ERROR_WITHOUT_LOCATION, OnceoverFormatter::ERROR_WITH_LOCATION
Instance Method Summary
collapse
#black, #blue, #bold, #calculate_relative_source, #class_name, #cyan, #extract_failures, #green, #initialize, #longest_group, #magenta, #parse_errors, #red, #white, #yellow
Instance Method Details
#dump_failures(notification) ⇒ Object
229
230
231
232
233
234
235
236
237
238
239
240
241
|
# File 'lib/onceover/rspec/formatters.rb', line 229
def dump_failures notification
require 'securerandom'
random_string = SecureRandom.hex
FileUtils.mkdir_p "#{RSpec.configuration.onceover_tempdir}/parallel"
File.open("#{RSpec.configuration.onceover_tempdir}/parallel/results-#{random_string}.yaml", "w") do |file|
file.write((notification).to_yaml)
end
end
|
#example_failed(notification) ⇒ Object
219
220
221
222
|
# File 'lib/onceover/rspec/formatters.rb', line 219
def example_failed notification
@output << red('F')
@output.flush
end
|
#example_group_started(notification) ⇒ Object
210
211
212
|
# File 'lib/onceover/rspec/formatters.rb', line 210
def example_group_started notification
end
|
#example_passed(notification) ⇒ Object
214
215
216
217
|
# File 'lib/onceover/rspec/formatters.rb', line 214
def example_passed notification
@output << green('P')
@output.flush
end
|
#example_pending(notification) ⇒ Object
224
225
226
227
|
# File 'lib/onceover/rspec/formatters.rb', line 224
def example_pending notification
@output << yellow('?')
@output.flush
end
|
#output_results(directory) ⇒ Object
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
|
# File 'lib/onceover/rspec/formatters.rb', line 243
def output_results(directory)
require 'rspec/core/example'
results = {}
files = Dir["#{directory}/*.yaml"]
errors = files.reduce({}) do |errs, file|
errs.merge(YAML.load(File.read(file)))
end
files.each { |f| File.delete(f) }
@output << "\n\n\n"
errors.each do |_name, role|
@output << Onceover::Controlrepo.evaluate_template('error_summary.yaml.erb', binding)
end
@output << "\n"
end
|