lib/respec/formatter.rb in respec-0.8.2 vs lib/respec/formatter.rb in respec-0.8.3
- old
+ new
@@ -1,11 +1,11 @@
require 'rspec/core/formatters/base_formatter'
require 'rspec/core/version'
module Respec
def self.failures_path
- ENV['RESPEC_FAILURES'] || File.expand_path(".respec_failures")
+ @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
@@ -52,6 +52,9 @@
# 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