Sha256: c8b84e29c58451fb456dba75da9bf3c7b31fea5cd98e28d4c5e7ec5205aa05ff
Contents?: true
Size: 951 Bytes
Versions: 3
Compression:
Stored size: 951 Bytes
Contents
shared_context "a Celluloid Mailbox" do it "receives messages" do message = :ohai subject << message subject.receive.should == message end it "prioritizes system events over other messages" do subject << :dummy1 subject << :dummy2 subject << Celluloid::SystemEvent.new subject.receive.should be_a(Celluloid::SystemEvent) end it "selectively receives messages with a block" do class Foo; end class Bar; end class Baz; end foo, bar, baz = Foo.new, Bar.new, Baz.new subject << baz subject << foo subject << bar subject.receive { |msg| msg.is_a? Foo }.should == foo subject.receive { |msg| msg.is_a? Bar }.should == bar subject.receive.should == baz end it "waits for a given timeout interval" do interval = 0.1 started_at = Time.now subject.receive(interval) { false } (Time.now - started_at).should be_within(TIMER_QUANTUM).of interval end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
celluloid-0.12.0.pre3 | spec/support/mailbox_examples.rb |
celluloid-0.12.0.pre2 | spec/support/mailbox_examples.rb |
celluloid-0.12.0.pre | spec/support/mailbox_examples.rb |