Sha256: 7c15636e28b5b06e94adacba806c75dca3423e97245c99b09e893ca0e96ffc70

Contents?: true

Size: 697 Bytes

Versions: 2

Compression:

Stored size: 697 Bytes

Contents

require 'muack/mock'
require 'muack/stub'
require 'muack/proxy'
require 'muack/any_instance_of'

module Muack
  class Session < Hash
    def mock       obj; self["mk #{obj.__id__}"] ||= Mock     .new(obj); end
    def stub       obj; self["sb #{obj.__id__}"] ||= Stub     .new(obj); end
    def mock_proxy obj; self["mp #{obj.__id__}"] ||= MockProxy.new(obj); end
    def stub_proxy obj; self["sp #{obj.__id__}"] ||= StubProxy.new(obj); end

    def any_instance_of klass
      (@any_instance_of ||= {})[klass.__id__] ||= AnyInstanceOf.new(klass)
    end

    def verify
      each_value.all?(&:__mock_verify)
    end

    def reset
      each_value(&:__mock_reset)
      clear
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
muack-0.5.2 lib/muack/session.rb
muack-0.5.1 lib/muack/session.rb