mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
edaa1383f2
This change brings some order to how we require files. Previously, we required app files from everywhere, including pry.rb. Now we require app files only from pry.rb. External and stdlib dependencies are required at places where they're used, not globally.
54 lines
1.2 KiB
Ruby
54 lines
1.2 KiB
Ruby
if ENV['COVERAGE']
|
|
require 'simplecov'
|
|
SimpleCov.start
|
|
end
|
|
|
|
require 'pry'
|
|
require 'rspec'
|
|
|
|
require 'pry/testable'
|
|
require 'English'
|
|
require 'stringio'
|
|
|
|
Dir['./spec/support/**/*.rb'].map do |file|
|
|
require file
|
|
end
|
|
|
|
class Module
|
|
# False positive: https://github.com/rubocop-hq/rubocop/issues/5953
|
|
# rubocop:disable Style/AccessModifierDeclarations
|
|
public :remove_const
|
|
public :remove_method
|
|
# rubocop:enable Style/AccessModifierDeclarations
|
|
end
|
|
|
|
Pad = Class.new do
|
|
include Pry::Config::Behavior
|
|
end.new(nil)
|
|
|
|
# to help with tracking down bugs that cause an infinite loop in the test suite
|
|
if ENV["SET_TRACE_FUNC"]
|
|
set_trace_func(
|
|
proc { |event, file, line, id, _binding, classname|
|
|
STDERR.printf("%8s %s:%-2d %10s %8s\n", event, file, line, id, classname)
|
|
}
|
|
)
|
|
end
|
|
|
|
RSpec.configure do |config|
|
|
config.expect_with :rspec do |c|
|
|
c.syntax = [:should, :expect]
|
|
end
|
|
|
|
config.before(:each) do
|
|
Pry::Testable.set_testenv_variables
|
|
end
|
|
|
|
config.after(:each) do
|
|
Pry::Testable.unset_testenv_variables
|
|
end
|
|
config.include Pry::Testable::Mockable
|
|
config.include Pry::Testable::Utility
|
|
include Pry::Testable::Evalable
|
|
include Pry::Testable::Variables
|
|
end
|