From 8a89a2c4bfa323495416fc17affd87bd4617c1af Mon Sep 17 00:00:00 2001 From: flippingbits Date: Wed, 1 Dec 2010 18:45:58 +0100 Subject: [PATCH] Added specs for Titan::Thread.remove_dead_threads --- spec/titan/thread_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/titan/thread_spec.rb b/spec/titan/thread_spec.rb index 340ea20..f819df6 100644 --- a/spec/titan/thread_spec.rb +++ b/spec/titan/thread_spec.rb @@ -207,4 +207,18 @@ def new_thread(id=nil) Titan::Thread.save_threads end end + + describe ".remove_dead_threads" do + it "should synchronize the threads" do + Titan::Thread.should_receive(:save_threads) + Titan::Thread.remove_dead_threads + end + + it "should return all threads" do + # avoid initializing a new Hash object + Titan::Thread.stub!(:load_threads) + new_thread + Titan::Thread.remove_dead_threads.should equal(Titan::Thread.all) + end + end end