spec/scheduler_spec.rb in rufus-scheduler-2.0.14 vs spec/scheduler_spec.rb in rufus-scheduler-2.0.15
- old
+ new
@@ -154,9 +154,53 @@
j.paused?.should == false
($count > c).should == true
end
end
end
+
+ context 'trigger threads' do
+
+ before(:each) do
+ @s = start_scheduler
+ end
+ after(:each) do
+ stop_scheduler(@s)
+ end
+
+ describe '#trigger_threads' do
+
+ it 'returns an empty list when no jobs are running' do
+
+ @s.trigger_threads.should == []
+ end
+
+ it 'returns a list of the threads of the running jobs' do
+
+ @s.in('100') { sleep 10 }
+
+ sleep 0.5
+
+ @s.trigger_threads.collect { |e| e.class }.should == [ Thread ]
+ end
+ end
+
+ describe '#running_jobs' do
+
+ it 'returns an empty list when no jobs are running' do
+
+ @s.running_jobs.should == []
+ end
+
+ it 'returns a list of the currently running jobs' do
+
+ job = @s.in('100') { sleep 10 }
+
+ sleep 0.5
+
+ @s.running_jobs.should == [ job ]
+ end
+ end
+ end
end
describe 'Rufus::Scheduler#start_new' do
it 'piggybacks EM if present and running' do