Sha256: b7619296dab73b22fb5d3dba232af2eb516a2d0bce2f5c9e81ae8837e39f4dfc

Contents?: true

Size: 852 Bytes

Versions: 7

Compression:

Stored size: 852 Bytes

Contents

# encoding: utf-8
require 'minitest_helper'
require 'say_when/poller/base_poller'

describe SayWhen::Poller::BasePoller do

  class TestPoller; include(SayWhen::Poller::BasePoller); end

  let (:poller) { TestPoller.new }
  let (:time_now) { Time.now }

  it 'handles errors' do
    job = Minitest::Mock.new
    job.expect(:release, true)
    err = nil
    begin
      raise RuntimeError.new('bad')
    rescue RuntimeError => ex
      err = ex
    end

    poller.job_error("oh noes", job, err)
  end

  it "can acquire a job" do
    poller.acquire(time_now)
  end

  it "can process a job" do
    job = Minitest::Mock.new
    job.expect(:fired, true, [Object])
    poller.process(job, time_now)
  end

  it "can process jobs" do
    poller.process_jobs
  end

  it "defines an error tick length" do
    poller.error_tick_length.must_equal 0
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
say_when-2.2.1 test/say_when/poller/base_poller_test.rb
say_when-2.2.0 test/say_when/poller/base_poller_test.rb
say_when-2.1.1 test/say_when/poller/base_poller_test.rb
say_when-2.1.0 test/say_when/poller/base_poller_test.rb
say_when-2.0.2 test/say_when/poller/base_poller_test.rb
say_when-2.0.1 test/say_when/poller/base_poller_test.rb
say_when-2.0.0 test/say_when/poller/base_poller_test.rb