Sha256: 4c88afb2498c0141d69c3c87008a5a1d5e489be2ea615da129006de9b97e8fec

Contents?: true

Size: 519 Bytes

Versions: 2

Compression:

Stored size: 519 Bytes

Contents

require 'spec_helper'

class MyService
  include Wisper

  def execute
    broadcast('success', self)
  end
end

# help me...
$global = nil

class MyListener
  def success(command)
    $global = Thread.current.object_id
  end
end

describe Wisper do

  it 'broadcasts event in different thread' do
    listener = MyListener.new

    command = MyService.new

    command.add_listener(listener, :async => true)

    command.execute
    sleep(1) # seriously...
    $global.should_not == Thread.current.object_id
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wisper-async-0.1.0 spec/lib/wisper/async_spec.rb
wisper-async-0.0.1 spec/lib/wisper/async_spec.rb