Sha256: 09b8fba63e69a0c83970f99d841bf6df5a79e20ec5953d03b85bcaf0e2990190

Contents?: true

Size: 818 Bytes

Versions: 10

Compression:

Stored size: 818 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

  after do
    Asynchronic.environment.data_store.clear
  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

10 entries across 10 versions & 1 rubygems

Version Path
asynchronic-1.6.3 spec/queue_engine/synchronic_spec.rb
asynchronic-1.6.2 spec/queue_engine/synchronic_spec.rb
asynchronic-1.6.1 spec/queue_engine/synchronic_spec.rb
asynchronic-1.6.0 spec/queue_engine/synchronic_spec.rb
asynchronic-1.5.2 spec/queue_engine/synchronic_spec.rb
asynchronic-1.5.1 spec/queue_engine/synchronic_spec.rb
asynchronic-1.5.0 spec/queue_engine/synchronic_spec.rb
asynchronic-1.4.0 spec/queue_engine/synchronic_spec.rb
asynchronic-1.3.1 spec/queue_engine/synchronic_spec.rb
asynchronic-1.3.0 spec/queue_engine/synchronic_spec.rb