spec/job_spec.rb in rufus-scheduler-2.0.13 vs spec/job_spec.rb in rufus-scheduler-2.0.14
- old
+ new
@@ -152,10 +152,44 @@
job.next_time.class.should == Time
job.next_time.to_i.should == t.to_i
end
end
+
+ describe '#paused?' do
+
+ it 'returns false initially' do
+
+ job = @s.every '3h' do; end
+
+ job.paused?.should == false
+ end
+ end
+
+ describe '#pause' do
+
+ it 'pauses the job' do
+
+ job = @s.every '3h' do; end
+
+ job.pause
+
+ job.paused?.should == true
+ end
+ end
+
+ describe '#resume' do
+
+ it 'resumes the job' do
+
+ job = @s.every '3h' do; end
+
+ job.resume
+
+ job.paused?.should == false
+ end
+ end
end
describe Rufus::Scheduler::CronJob do
describe '#next_time' do
@@ -165,9 +199,43 @@
job = @s.cron '* * * * *' do
end
job.next_time.class.should == Time
(job.next_time.to_i - Time.now.to_i).should satisfy { |v| v < 60 }
+ end
+ end
+
+ describe '#paused?' do
+
+ it 'returns false initially' do
+
+ job = @s.cron '* * * * *' do; end
+
+ job.paused?.should == false
+ end
+ end
+
+ describe '#pause' do
+
+ it 'pauses the job' do
+
+ job = @s.cron '* * * * *' do; end
+
+ job.pause
+
+ job.paused?.should == true
+ end
+ end
+
+ describe '#resume' do
+
+ it 'resumes the job' do
+
+ job = @s.cron '* * * * *' do; end
+
+ job.resume
+
+ job.paused?.should == false
end
end
end
end