Module: Funktor::TestingPusher

Included in:
JobPusher
Defined in:
lib/funktor/testing.rb

Instance Method Summary collapse

Instance Method Details

#push(payload) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/funktor/testing.rb', line 75

def push(payload)
  if Funktor::Testing.inline?
    Funktor.job_pusher_middleware.invoke(payload) do
      payload = payload.with_indifferent_access
      worker = Object.const_get payload["worker"]
      worker.new.perform(*payload["worker_params"])
    end
  elsif Funktor::Testing.fake?
    Funktor.job_pusher_middleware.invoke(payload) do
      Funktor::FakeJobQueue.push(payload)
    end
  else
    super
  end
end