Sha256: ad6b901bc3220ef8b24fb3a448107957e2afc84dd5a0731af69ab414f5b7af77

Contents?: true

Size: 789 Bytes

Versions: 1

Compression:

Stored size: 789 Bytes

Contents

require 'helper'

class TestSideband < Minitest::Test

  def test_autoinitialization
    assert Sideband.queue << -> { 'work' }
  end

  def test_has_queue
    Sideband.initialize!
    assert_kind_of Sideband::Queue, Sideband.queue
  end

  def test_can_access_queue_or_send_jobs
    Sideband.initialize!
    assert Sideband.queue(-> { 'work' })
    assert Sideband.enqueue(-> { 'work' })
  end

  def test_sideband_execution_success
    $sideband_test_variable = 1

    Sideband.initialize!

    Sideband.queue(-> { $sideband_test_variable = 2 })
    Sideband.queue(-> { $sideband_test_variable = 3 })

    sleep 1

    assert_equal 3, $sideband_test_variable

    Sideband.queue << (-> { $sideband_test_variable = 4 })

    sleep 1

    assert_equal 4, $sideband_test_variable
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sideband-1.0.4 test/test_sideband.rb