Sha256: c1cceca65a0d8787ba87f5d2f3d33d8e441e40328ac6ad7c16edb7974bb4e140

Contents?: true

Size: 1.77 KB

Versions: 25

Compression:

Stored size: 1.77 KB

Contents

# good idea ???
# if you're testing pry plugin you should require pry by yourself, no?
require 'pry' if not defined?(Pry)

module Pry::Testable
  extend self
  require_relative "testable/pry_tester"
  require_relative "testable/evalable"
  require_relative "testable/mockable"
  require_relative "testable/variables"
  require_relative "testable/utility"

  #
  # When {Pry::Testable} is included into another module or class,
  # the following modules are also included: {Pry::Testable::Mockable},
  # {Pry::Testable::Evalable}, {Pry::Testable::Variables}, and
  # {Pry::Testable::Utility}.
  #
  # @note
  #   Each of the included modules mentioned above may also be used
  #   standalone or in a pick-and-mix fashion.
  #
  # @param [Module] mod
  #   A class or module.
  #
  # @return [void]
  #
  def self.included(mod)
    mod.module_eval do
      include Pry::Testable::Mockable
      include Pry::Testable::Evalable
      include Pry::Testable::Variables
      include Pry::Testable::Utility
    end
  end

  TEST_DEFAULTS = {
    color: false,
    pager: false,
    should_load_rc: false,
    should_load_local_rc: false,
    correct_indent: false,
    collison_warning: false,
    history: {
      should_load: false,
      should_save: false
    }
  }
  private_constant :TEST_DEFAULTS

  #
  # Sets various configuration options that make Pry optimal for a test
  # environment, see source code for complete details.
  #
  # @return [void]
  #
  def self.set_testenv_variables
    Pry.config = Pry::Config.from_hash(TEST_DEFAULTS, Pry::Config::Default.new)
    Pry.config.hooks = Pry::Hooks.new
  end

  #
  # Reset the Pry configuration to their default values.
  #
  # @return [void]
  #
  def self.unset_testenv_variables
    Pry.config = Pry::Config.from_hash({}, Pry::Config::Default.new)
  end
end

Version data entries

25 entries across 25 versions & 11 rubygems

Version Path
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/testable.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/testable.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/pry-0.12.2/lib/pry/testable.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/testable.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/testable.rb
dadapush_client-1.0.1 vendor/bundle/ruby/2.3.0/gems/pry-0.11.3/lib/pry/testable.rb
chess_engine-0.0.2 vendor/bundle/gems/pry-0.12.2/lib/pry/testable.rb
chess_engine-0.0.1 vendor/bundle/gems/pry-0.12.2/lib/pry/testable.rb
xaiml-0.1.3 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/testable.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/testable.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/testable.rb
xaiml-0.1.2 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/testable.rb
pry-0.12.2-java lib/pry/testable.rb
pry-0.12.2 lib/pry/testable.rb
pry-0.12.1 lib/pry/testable.rb
pry-0.12.1-java lib/pry/testable.rb
pry-0.12.0 lib/pry/testable.rb
pry-0.12.0-java lib/pry/testable.rb
xaiml-0.1.1 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/testable.rb
xaiml-0.1.0 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/testable.rb