Module: Jackal::Utils::Spec::CallbackLocal

Defined in:
lib/jackal/utils/spec/callback_local.rb

Overview

Callback helper module for isolated testing

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object Also known as: included

Init data store for internal message capture



23
24
25
26
27
# File 'lib/jackal/utils/spec/callback_local.rb', line 23

def extended(klass)
  klass.instance_eval do
    @forwarded = []
  end
end

Instance Method Details

#forward(payload) ⇒ Object

Force payload into local store

Parameters:

  • payload (Hash)


17
18
19
# File 'lib/jackal/utils/spec/callback_local.rb', line 17

def forward(payload)
  @forwarded << payload
end

#forwardedArray

Returns forwarded payloads.

Returns:

  • (Array)

    forwarded payloads



10
11
12
# File 'lib/jackal/utils/spec/callback_local.rb', line 10

def forwarded
  @forwarded ||= []
end