spec/support/mailbox_examples.rb in celluloid-0.14.1 vs spec/support/mailbox_examples.rb in celluloid-0.15.0.pre
- old
+ new
@@ -41,11 +41,11 @@
it "has a size" do
subject.should respond_to(:size)
subject.size.should be_zero
subject << :foo
subject << :foo
- subject.size.should be 2
+ subject.should have(2).entries
end
it "discards messages received when when full" do
subject.max_size = 2
subject << :first
@@ -53,14 +53,26 @@
subject << :third
subject.to_a.should =~ [:first, :second]
end
it "logs discarded messages" do
- Celluloid.logger = mock.as_null_object
- Celluloid.logger.should_receive(:debug).with("Discarded message: third")
+ Celluloid.logger = double.as_null_object
+ Celluloid.logger.should_receive(:debug).with("Discarded message (mailbox is dead): third")
subject.max_size = 2
subject << :first
subject << :second
+ subject << :third
+ end
+
+ it "discard messages when dead" do
+ Celluloid.logger = double.as_null_object
+ Celluloid.logger.should_receive(:debug).with("Discarded message (mailbox is dead): first")
+ Celluloid.logger.should_receive(:debug).with("Discarded message (mailbox is dead): second")
+ Celluloid.logger.should_receive(:debug).with("Discarded message (mailbox is dead): third")
+
+ subject << :first
+ subject << :second
+ subject.shutdown
subject << :third
end
end