spec/support/mailbox_examples.rb in celluloid-0.11.1 vs spec/support/mailbox_examples.rb in celluloid-0.12.0.pre

- old
+ new

@@ -1,34 +1,19 @@ shared_context "a Celluloid Mailbox" do - # Level of timer accuracy enforced by the tests (50ms) - Q = 0.05 - - class TestEvent < Celluloid::SystemEvent; end - it "receives messages" do message = :ohai subject << message subject.receive.should == message end - it "raises system events when received" do - subject.system_event TestEvent.new("example") - - expect do - subject.receive - end.to raise_exception(TestEvent) - end - it "prioritizes system events over other messages" do subject << :dummy1 subject << :dummy2 - subject.system_event TestEvent.new("example") - expect do - subject.receive - end.to raise_exception(TestEvent) + 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 @@ -48,8 +33,8 @@ 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(Q).of interval + (Time.now - started_at).should be_within(TIMER_QUANTUM).of interval end end