Class: FailureCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/onceover/rspec/formatters.rb

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ FailureCollector

Returns a new instance of FailureCollector.



299
300
301
# File 'lib/onceover/rspec/formatters.rb', line 299

def initialize(output)
  FileUtils.touch(File.expand_path("#{RSpec.configuration.onceover_tempdir}/failures.out"))
end

Instance Method Details

#dump_failures(failures) ⇒ Object



303
304
305
306
307
308
309
310
311
312
313
# File 'lib/onceover/rspec/formatters.rb', line 303

def dump_failures(failures)
  File.open(File.expand_path("#{RSpec.configuration.onceover_tempdir}/failures.out"), 'a') { |f|
    failures.failed_examples.each do |fe|
      f.puts
      f.puts "#{fe.[:description]}"
      f.puts "#{fe.[:execution_result].exception.to_s}"
      f.puts "#{fe.[:file_path]}:#{fe.[:line_number]}"
      f.puts "------------------------------------------------------"
    end
  }
end