Sha256: e5102c121fcfc6ce137fb3d13268ce81862e5a58eecc88a9aa379219efa8c958

Contents?: true

Size: 630 Bytes

Versions: 12

Compression:

Stored size: 630 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

      expect(count).to eq(0)
      expect(s.counter).to eq(1)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rufus-scheduler-3.1.9 spec/lock_custom_spec.rb
rufus-scheduler-3.1.8 spec/lock_custom_spec.rb
rufus-scheduler-3.1.7 spec/lock_custom_spec.rb
rufus-scheduler-3.1.6 spec/lock_custom_spec.rb
rufus-scheduler-3.1.5 spec/lock_custom_spec.rb
rufus-scheduler-3.1.4 spec/lock_custom_spec.rb
rufus-scheduler-3.1.3 spec/lock_custom_spec.rb
rufus-scheduler-3.1.2 spec/lock_custom_spec.rb
rufus-scheduler-3.1.1 spec/lock_custom_spec.rb
rufus-scheduler-3.1.0 spec/lock_custom_spec.rb
rufus-scheduler-3.0.9 spec/lock_custom_spec.rb
rufus-scheduler-3.0.8 spec/custom_locks_spec.rb