Sha256: 355246f1e0d1b86746d00c638a6f57cb8a3b8ad8d324c7f2e7ea6eefaf69f072
Contents?: true
Size: 1.59 KB
Versions: 3
Compression:
Stored size: 1.59 KB
Contents
require 'rspec/core/formatters/base_formatter' require 'rspec/core/version' module Respec def self.failures_path @failures_path ||= ENV['RESPEC_FAILURES'] || File.expand_path(".respec_failures") end if (RSpec::Core::Version::STRING.scan(/\d+/).map { |s| s.to_i } <=> [3]) < 0 class Formatter < RSpec::Core::Formatters::BaseFormatter def initialize(output=nil) super(output) end def start_dump open(Respec.failures_path, 'w') do |file| @failed_examples.each do |example| file.puts example.metadata[:full_description] end end end end else class Formatter < RSpec::Core::Formatters::BaseFormatter def initialize(output=nil) @respec_failures = [] super(output) end def example_failed(notification) @respec_failures << notification.example.full_description end def start_dump(notification) open(Respec.failures_path, 'w') do |file| @respec_failures.each do |failure| file.puts failure end end end RSpec::Core::Formatters.register self, :example_failed, :start_dump end end end # We inject this here rather than on the command line, as the logic to assemble # the list of formatters is complex, and easily broken by adding a --format # option. RSpec.configure do |config| config.add_formatter 'progress' if config.formatters.empty? config.add_formatter Respec::Formatter # Memoize this before any tests run in case a test messes up the pwd. config.before(:all) { Respec.failures_path } end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
respec-0.9.1 | lib/respec/formatter.rb |
respec-0.9.0 | lib/respec/formatter.rb |
respec-0.8.3 | lib/respec/formatter.rb |