Sha256: 75ecb2385bfd7850a7646c0a31c90a1dab4b828a52fcca99801daed7d3d4bb4e

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 KB

Contents

require 'pry'
require_relative 'pry_debugger'
require_relative '../playground/playground.rb'

PryDebugger.inject unless ENV['DEBUG']

RSpec.configure do |config|

  config.include PryDebugger::Breakpoints

  config.before(:example) do
    PryMoves.unlock if PryMoves.semaphore.locked?
  end

  config.after(:example) do |example|
    unless example.exception
      expect(PryDebugger.breakpoints.count).to be(0), "not all breakpoints launched: #{PryDebugger.breakpoints.count}"
    end
  end

end

RSpec::Core::BacktraceFormatter.class_eval do

  alias :native_backtrace_line :backtrace_line

  def format_backtrace(backtrace, options={})
    return [] unless backtrace
    return backtrace if options[:full_backtrace] || backtrace.empty?

    @lines = 0
    backtrace.map { |l| backtrace_line(l) }.compact
  end

  FILTER = /(\/gems\/|\/lib\/pry\/|spec\/pry_debugger\.rb)/
  def backtrace_line(line)
    return if @lines == 3 and not ENV['TRACE']
    #return if line.match FILTER
    return unless line.include? '/playground.rb'

    result = native_backtrace_line(line)
    if result
      @lines += 1 if @lines
      result[0 .. 1] == './' ? result[2 .. -1] : result
    end
  end

end

Pry::REPL.class_eval do
  def handle_read_errors
    yield
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pry-moves-0.1.13 spec/spec_helper.rb
pry-moves-0.1.12 spec/spec_helper.rb
pry-moves-0.1.10 spec/spec_helper.rb
pry-moves-0.1.9 spec/spec_helper.rb
pry-moves-0.1.8 spec/spec_helper.rb
pry-moves-0.1.7 spec/spec_helper.rb