Sha256: 330376cf79163651260533bf69d31eb5baab8845f71b0f7a01219578bcd79c47

Contents?: true

Size: 763 Bytes

Versions: 42

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

42 entries across 42 versions & 4 rubygems

Version Path
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
mocha-2.0.0.alpha lib/mocha/receivers.rb
mocha-1.15.0 lib/mocha/receivers.rb
mocha-1.14.0 lib/mocha/receivers.rb
mocha-1.13.0 lib/mocha/receivers.rb
mocha-1.12.0 lib/mocha/receivers.rb
mocha-1.11.2 lib/mocha/receivers.rb
mocha-1.11.1 lib/mocha/receivers.rb
mocha-1.11.0 lib/mocha/receivers.rb
mocha-1.10.2 lib/mocha/receivers.rb
mocha-1.10.1 lib/mocha/receivers.rb
mocha-1.10.0 lib/mocha/receivers.rb
mocha-1.10.0.beta.1 lib/mocha/receivers.rb
mocha-1.10.0.alpha lib/mocha/receivers.rb
mocha-1.9.0 lib/mocha/receivers.rb
cocoapods-dependency-html-0.0.2 vendor/bundle/gems/mocha-1.8.0/lib/mocha/receivers.rb
cocoapods-dependency-html-0.0.1 vendor/bundle/gems/mocha-1.8.0/lib/mocha/receivers.rb