Sha256: 4485208270064b9cfdb1c2d23afb9b91d32a0ab189781249bf5340c3d899c953

Contents?: true

Size: 620 Bytes

Versions: 5

Compression:

Stored size: 620 Bytes

Contents

#
# Specifying rufus-scheduler
#
# Fri Nov  1 05:56:03 JST 2013
#
# Ishinomaki
#

require 'spec_helper'


describe Rufus::Scheduler do

  class LosingLockScheduler < Rufus::Scheduler

    attr_reader :counter

    def initialize
      super
      @counter = 0
    end

    def confirm_lock
      @counter = @counter + 1
      false
    end
  end

  context 'custom locks' do

    it 'does not trigger when #confirm_lock returns false' do

      s = LosingLockScheduler.new

      count = 0

      s.in('0s') { count = count + 1 }

      sleep 0.7

      count.should == 0
      s.counter.should == 1
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rufus-scheduler-3.0.7 spec/custom_locks_spec.rb
rufus-scheduler-3.0.6 spec/custom_locks_spec.rb
rufus-scheduler-3.0.5 spec/custom_locks_spec.rb
rufus-scheduler-3.0.4 spec/custom_locks_spec.rb
rufus-scheduler-3.0.3 spec/custom_locks_spec.rb