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_failure_data, #extract_failures, #green, #initialize, #longest_group, #magenta, #parse_errors, #red, #white, #yellow
Instance Method Details
#dump_failures(notification) ⇒ Object
260
261
262
263
264
265
266
267
268
269
270
271
272
|
# File 'lib/onceover/rspec/formatters.rb', line 260
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
250
251
252
253
|
# File 'lib/onceover/rspec/formatters.rb', line 250
def example_failed notification
@output << red('F')
@output.flush
end
|
#example_group_started(notification) ⇒ Object
241
242
243
|
# File 'lib/onceover/rspec/formatters.rb', line 241
def example_group_started notification
end
|
#example_passed(notification) ⇒ Object
245
246
247
248
|
# File 'lib/onceover/rspec/formatters.rb', line 245
def example_passed notification
@output << green('P')
@output.flush
end
|
#example_pending(notification) ⇒ Object
255
256
257
258
|
# File 'lib/onceover/rspec/formatters.rb', line 255
def example_pending notification
@output << yellow('?')
@output.flush
end
|
#output_results(directory) ⇒ Object
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
# File 'lib/onceover/rspec/formatters.rb', line 274
def output_results(directory)
require 'rspec/core/example'
results = {}
files = Dir["#{directory}/*.yaml"]
roles = files.reduce({}) do |errs, file|
errs.merge(YAML.load(File.read(file))) {|key, oldval, newval| [oldval, newval].flatten } end
files.each { |f| File.delete(f) }
@output << "\n\n\n"
roles.each do |name, errors|
@output << Onceover::Controlrepo.evaluate_template('error_summary.yaml.erb', binding)
end
@output << "\n"
end
|