Sha256: 330376cf79163651260533bf69d31eb5baab8845f71b0f7a01219578bcd79c47

Contents?: true

Size: 763 Bytes

Versions: 38

Compression:

Stored size: 763 Bytes

Contents

module Mocha
  class ObjectReceiver
    def initialize(object)
      @object = object
    end

    def mocks
      object = @object
      mocks = []
      while object
        mocha = object.mocha(false)
        mocks << mocha if mocha
        object = object.is_a?(Class) ? object.superclass : nil
      end
      mocks
    end
  end

  class AnyInstanceReceiver
    def initialize(klass)
      @klass = klass
    end

    def mocks
      klass = @klass
      mocks = []
      while klass
        mocha = klass.any_instance.mocha(false)
        mocks << mocha if mocha
        klass = klass.superclass
      end
      mocks
    end
  end

  class DefaultReceiver
    def initialize(mock)
      @mock = mock
    end

    def mocks
      [@mock]
    end
  end
end

Version data entries

38 entries across 38 versions & 3 rubygems

Version Path
mocha-2.6.0 lib/mocha/receivers.rb
mocha-2.5.0 lib/mocha/receivers.rb
mocha-2.4.5 lib/mocha/receivers.rb
mocha-2.4.4 lib/mocha/receivers.rb
mocha-2.4.3 lib/mocha/receivers.rb
mocha-2.4.2 lib/mocha/receivers.rb
mocha-2.4.1 lib/mocha/receivers.rb
mocha-2.4.0 lib/mocha/receivers.rb
mocha-2.2.0 lib/mocha/receivers.rb
mocha-2.1.0 lib/mocha/receivers.rb
mocha-2.0.4 lib/mocha/receivers.rb
mocha-2.0.3 lib/mocha/receivers.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/mocha-2.0.2/lib/mocha/receivers.rb
mocha-2.0.2 lib/mocha/receivers.rb
mocha-1.16.1 lib/mocha/receivers.rb
mocha-1.15.1 lib/mocha/receivers.rb
mocha-2.0.1 lib/mocha/receivers.rb
mocha-2.0.0 lib/mocha/receivers.rb
mocha-1.16.0 lib/mocha/receivers.rb
mocha-2.0.0.alpha.1 lib/mocha/receivers.rb