Sha256: 496b9b5be23613fa9ad5b65c38b5bc4130b3ff12adaa4ccaf1fec30dc0163288

Contents?: true

Size: 800 Bytes

Versions: 5

Compression:

Stored size: 800 Bytes

Contents

require 'spec_helper'
require 'gb_dispatch/runner'

describe GBDispatch::Runner do

  it 'should execute synchronously' do
    a = :foo
    GBDispatch::Runner.execute ->() { a=:bar }
    expect(a).to eq :bar
  end

  it 'should return result of passed block' do
    a = GBDispatch::Runner.execute ->() { :bar }
    expect(a).to eq :bar
  end

  it 'should execute on different thread' do
    Thread.current[:name] = :foo
    a = :foo
    GBDispatch::Runner.execute ->() do
      a = Thread.current[:name]
    end, name: :bar
    expect(a).not_to eq :foo
  end


  context 'error handling' do
    it 'should call Celluloid Conditions with exception' do
      expect { GBDispatch::Runner.execute ->() { raise StandardError.new 'Test' }, name: :fail_test }.to raise_error StandardError
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gb_dispatch-0.1.2 spec/runner_spec.rb
gb_dispatch-0.1.1 spec/runner_spec.rb
gb_dispatch-0.1.0 spec/runner_spec.rb
gb_dispatch-0.0.6 spec/runner_spec.rb
gb_dispatch-0.0.5 spec/runner_spec.rb