module TestBench

Public Class Methods

activate() click to toggle source
# File lib/test_bench/test_bench.rb, line 2
def self.activate
  # Monkeypatch assert, context, and test onto the main object
  unless TOPLEVEL_BINDING.receiver.is_a? Structure
    TOPLEVEL_BINDING.receiver.extend Structure
  end

  # Ruby pre 2.2 did not implement Binding#receiver
  unless TOPLEVEL_BINDING.respond_to? :receiver
    ::Binding.class_exec do
      def receiver
        eval "self"
      end
    end
  end
end

Public Instance Methods

receiver() click to toggle source
# File lib/test_bench/test_bench.rb, line 11
def receiver
  eval "self"
end