Sha256: 2030d922d242bacdcccc7b8e4442cc7f45147a79f27348a9ab13cb8a7798412e
Contents?: true
Size: 784 Bytes
Versions: 15
Compression:
Stored size: 784 Bytes
Contents
if ENV["RSPEC_REPORT_EXCEPTIONS"] class Exception alias_method :old_initialize, :initialize def self.exceptions_seen @@seen ||= {} end def self.see args stack = caller[1..-1] # Don't show expected exceptions or RSpec internal ones return if caller.detect{|s| s =~ %r{rspec/matchers/raise_error}} or self.name =~ /^RSpec::/ stack.reject!{|s| s =~ %r{/rspec/}} key = stack[0,4]+[self.name] return if exceptions_seen[key] exceptions_seen[key] = show = stack args[0] = args[0].to_str if args[0].class.name == "NameError::message" puts "#{self.name}#{args.inspect}:\n\t#{show*"\n\t"}" end def initialize *args, &b self.class.see args send(:old_initialize, *args, &b) end end end
Version data entries
15 entries across 15 versions & 1 rubygems