Sha256: 0f732da1fb8f102258cc27bc4725ac3bf652f1f692fc47e3d1f920af982c3399

Contents?: true

Size: 755 Bytes

Versions: 1

Compression:

Stored size: 755 Bytes

Contents

require 'minitest_helper'

describe Asynchronic::QueueEngine::Synchronic do

  before do
    Asynchronic.configure do |config|
      config.queue_engine = Asynchronic::QueueEngine::Synchronic.new
    end
  end

  it 'Original job' do
    pid = BasicJob.enqueue input: 1
    process = Asynchronic[pid]
    process.result.must_equal 2
  end

  it 'Stub job' do
    Asynchronic.queue_engine.stub BasicJob do |process|
      process.params[:input] + 19
    end
    
    pid = BasicJob.enqueue input: 1
    process = Asynchronic[pid]
    process.result.must_equal 20
  end

  it 'Graph job' do
    pid = GraphJob.enqueue input: 100
    process = Asynchronic[pid]
    process.must_be_completed
    process.result.must_equal '10%' => 20, '20%' => 40
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asynchronic-1.2.2 spec/queue_engine/synchronic_spec.rb