Sha256: 36cdb4ff6cb673e965770cafe3dbdaf39c3e215145ef2240bb404c731969672c

Contents?: true

Size: 689 Bytes

Versions: 12

Compression:

Stored size: 689 Bytes

Contents

module Mocha

  class ObjectReceiver

    def initialize(object)
      @object = object
    end

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

  end

  class AnyInstanceReceiver

    def initialize(klass)
      @klass = klass
    end

    def mocks
      klass, mocks = @klass, []
      while klass do
        mocks << klass.any_instance.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

12 entries across 9 versions & 2 rubygems

Version Path
mocha-1.5.0 lib/mocha/receivers.rb
mocha-1.4.0 lib/mocha/receivers.rb
mocha-1.3.0 lib/mocha/receivers.rb
mocha-1.2.1 lib/mocha/receivers.rb
mocha-1.2.0 lib/mocha/receivers.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/mocha-1.0.0/lib/mocha/receivers.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/mocha-1.0.0/lib/mocha/receivers.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/mocha-1.0.0/lib/mocha/receivers.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/mocha-1.0.0/lib/mocha/receivers.rb
mocha-1.1.0 lib/mocha/receivers.rb
mocha-1.0.0 lib/mocha/receivers.rb
mocha-1.0.0.alpha lib/mocha/receivers.rb