celluloid/celluloid — pull request #162 by halorgium (2013-10-06 04:56:03+00:00)
Title: multiple at_exit hooks are confusing

### Was: How to test (asynchronously) Celluloid::Notifications?

The following test passes when you run `rspec testfile.rb`. But if you run `ruby testfile.rb` you'll get "Celluloid::DeadActorError: notifications fanout actor not running" exception.

How can I keep the test waiting and the actor running? I tried using the `receive` method to keep waiting but without success.

``` ruby
require 'rspec/autorun'
require 'celluloid'

class Foo
include Celluloid
include Celluloid::Notifications

attr_reader :count

def update_counter(topic, counter)
@count ||= 0
@count += counter
end
end

class Bar
include Celluloid
include Celluloid::Notifications

def increase
publish('counters', 1)
end
end

describe Celluloid::Notifications do
it 'increases the counter' do
foo = Foo.new
foo.subscribe('counters', :update_counter)

bar = Bar.new
bar.increase

foo.count.should == 1
end
end
```