spec/schedule_every_spec.rb in rufus-scheduler-3.0.7 vs spec/schedule_every_spec.rb in rufus-scheduler-3.0.8
- old
+ new
@@ -22,12 +22,12 @@
it 'adds a job' do
@scheduler.every(10) do
end
- @scheduler.jobs.size.should == 1
- @scheduler.jobs.first.class.should == Rufus::Scheduler::EveryJob
+ expect(@scheduler.jobs.size).to eq(1)
+ expect(@scheduler.jobs.first.class).to eq(Rufus::Scheduler::EveryJob)
end
it 'triggers a job (2 times)' do
counter = 0
@@ -36,37 +36,37 @@
counter += 1
end
sleep 2.0
- counter.should > 2
+ expect(counter).to be > 2
end
it 'does not remove the job after execution' do
@scheduler.every(0.4) do
end
sleep 0.9
- @scheduler.jobs.size.should == 1
+ expect(@scheduler.jobs.size).to eq(1)
end
it 'raises on negative frequencies' do
- lambda {
+ expect {
@scheduler.every(-1) do
end
- }.should raise_error(ArgumentError)
+ }.to raise_error(ArgumentError)
end
it 'raises on zero frequencies' do
- lambda {
+ expect {
@scheduler.every(0) do
end
- }.should raise_error(ArgumentError)
+ }.to raise_error(ArgumentError)
end
it 'does not reschedule if the job was unscheduled' do
counter = 0
@@ -81,29 +81,29 @@
job.unschedule
c = counter
sleep 1.6
- counter.should == c
+ expect(counter).to eq(c)
end
it 'raises if the job frequency is higher than the scheduler frequency' do
@scheduler.frequency = 10
- lambda {
+ expect {
@scheduler.every '1s' do; end
- }.should raise_error(ArgumentError)
+ }.to raise_error(ArgumentError)
end
end
describe '#schedule_every' do
it 'accepts a duration string' do
job = @scheduler.schedule_every('1h') do; end
- job.frequency.should == 3600.0
+ expect(job.frequency).to eq(3600.0)
end
end
end