summaryrefslogtreecommitdiff
path: root/spec/helper.rb
blob: 960d6719b9abb683040c4f1ba4af8b8e05d1ead1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
require "bundler/setup"

if ENV["COVERAGE"]
  require "simplecov"
  SimpleCov.start
end

unless Object.const_defined? 'Pry'
  $:.unshift File.expand_path '../../lib', __FILE__
  require 'pry'
end

require 'mocha/api'
require 'ostruct'
require 'pry/test/helper'
require 'minitest/autorun'
require 'minitest/spec'
require 'minitest/bacon'
require 'minitest/pride'
require_relative 'spec_helpers/mock_pry'
require_relative 'spec_helpers/repl_tester'

class Module
  public :remove_const
  public :remove_method
end

class Minitest::Spec
  extend  PryTestHelpers
  include PryTestHelpers

  def setup
    Pry.toplevel_binding = nil
    super
  end
end

# turn warnings off (esp for Pry::Hooks which will generate warnings
# in tests)
$VERBOSE = nil

Pad = OpenStruct.new
def Pad.clear
  @table = {}
end

# to help with tracking down bugs that cause an infinite loop in the test suite
if ENV["SET_TRACE_FUNC"]
  require 'set_trace' if Pry::Helpers::BaseHelpers.rbx?
  set_trace_func proc { |event, file, line, id, binding, classname|
     STDERR.printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname
  }
end

puts "Ruby v#{RUBY_VERSION} (#{defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"}), Pry v#{Pry::VERSION}, method_source v#{MethodSource::VERSION}, CodeRay v#{CodeRay::VERSION}, Slop v#{Slop::VERSION}"