spec/every_spec.rb in rufus-scheduler-2.0.18 vs spec/every_spec.rb in rufus-scheduler-2.0.19
- old
+ new
@@ -41,9 +41,54 @@
sleep 3.7
var.should == 3
end
+ it 'schedules every 0.1s' do
+
+ var = 0
+
+ job = @s.every '0.1s' do
+ var += 1
+ end
+
+ sleep 3.7
+
+ var.should be_within(10).of(37)
+ end
+
+ it 'raises on schedule every 0s' do
+
+ lambda {
+ @s.every '0s' do
+ end
+ }.should raise_error(ArgumentError)
+ end
+
+ it 'raises on schedule every -1s' do
+
+ lambda {
+ @s.every '-1s' do
+ end
+ }.should raise_error(ArgumentError)
+ end
+
+ it 'raises on schedule every \'\'' do
+
+ lambda {
+ @s.every '' do
+ end
+ }.should raise_error(ArgumentError)
+ end
+
+ it 'raises on schedule every nil' do
+
+ lambda {
+ @s.every nil do
+ end
+ }.should raise_error(ArgumentError)
+ end
+
it 'is punctilious' do
hits = []
job = @s.every '1s' do