File: job_array_spec.rb

package info (click to toggle)
ruby-rufus-scheduler 3.8.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 524 kB
  • sloc: ruby: 4,324; makefile: 26
file content (39 lines) | stat: -rw-r--r-- 623 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

#
# Specifying rufus-scheduler
#
# Wed Apr 17 06:00:59 JST 2013
#

require 'spec_helper'


describe Rufus::Scheduler::JobArray do

  class DummyJob < Struct.new(:id, :next_time); end

  before(:each) do
    @array = Rufus::Scheduler::JobArray.new
  end

  describe '#push' do

    it 'pushes jobs' do

      @array.push(DummyJob.new('a', Time.local(0)))

      expect(@array.to_a.collect(&:id)).to eq(%w[ a ])
    end

    it 'pushes and remove duplicates' do

      j = DummyJob.new('a', Time.local(0))

      @array.push(j)
      @array.push(j)

      expect(@array.to_a.collect(&:id)).to eq(%w[ a ])
    end
  end
end