if defined?(RSpec)
  bundle_patterns = [%r{/RSpec\.tmbundle/}, %r{^/tmp/textmate-command}]
  if RSpec.configuration.respond_to?(:backtrace_exclusion_patterns)
    RSpec.configuration.backtrace_exclusion_patterns += bundle_patterns
  elsif RSpec.configuration.respond_to?(:backtrace_clean_patterns)
    RSpec.configuration.backtrace_clean_patterns += bundle_patterns
  end
end

if defined?(RSpec)
  bundle_patterns = [%r{^/tmp/textmate-command}]
  bundle_patterns << %r{/RSpec\.tmbundle/} unless ENV['TM_PROJECT_DIRECTORY'].include?("RSpec.tmbundle")
  if RSpec.configuration.respond_to?(:backtrace_exclusion_patterns)
    RSpec.configuration.backtrace_exclusion_patterns += bundle_patterns
  elsif RSpec.configuration.respond_to?(:backtrace_clean_patterns)
    RSpec.configuration.backtrace_clean_patterns += bundle_patterns
  end
end

Fix backtrace for running the bundle’s own specs.
Fix backtrace for running the bundle’s own specs.

When running the bundle’s own specs *all* backtrace lines got filtered out, so that RSpec showed the complete backtrace as a fallback.
