Sha256: 829be8c69a3dd0fe2e897ab8187601bb02b08b2ef71c10730ccde5f5944a4198

Contents?: true

Size: 565 Bytes

Versions: 9

Compression:

Stored size: 565 Bytes

Contents

require 'muack/mock'

module Muack
  class Spy < Mock
    def initialize stub
      super(stub.object)
      @secret = stub.__mock_disps.values.flatten # steal disps
    end

    # used for Muack::Session#verify
    def __mock_verify
      @secret.each{ |defi| __mock_dispatch(defi.msg, defi.args) }
      super # simulate dispatching before passing to mock to verify
    end

    # used for Muack::Session#reset, but spies never leave any track
    def __mock_reset; end

    private
    def __mock_inject_method defi; end # spies don't leave any track
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
muack-1.0.4 lib/muack/spy.rb
muack-1.0.3 lib/muack/spy.rb
muack-1.0.2 lib/muack/spy.rb
muack-1.0.1 lib/muack/spy.rb
muack-1.0.0 lib/muack/spy.rb
muack-0.7.3 lib/muack/spy.rb
muack-0.7.2 lib/muack/spy.rb
muack-0.7.1 lib/muack/spy.rb
muack-0.7.0 lib/muack/spy.rb