Sha256: de1b78fa424ab1b52c6ff0f6f907ae170975b4b74d4a6a59d030762690e8a6cf

Contents?: true

Size: 622 Bytes

Versions: 2

Compression:

Stored size: 622 Bytes

Contents

require 'timeout'
require File.expand_path('../spec_helper', __FILE__)

module TestModule
  class TestJob < DCA::Jobs::Job
  end

  class LoopJob < DCA::Jobs::Job
    def perform
      loop do
        sleep 1
        break if shutdown?
      end
    end
  end
end

describe 'Job' do
  it 'should get queue name from module name' do
    TestModule::TestJob.queue.should == 'TestModule'
  end

  it 'should shutdown when QUIT signal is happened' do
    job_pid = Process.fork { TestModule::LoopJob.create }
    sleep 1
    Process.kill 'QUIT', job_pid
    Timeout::timeout(1) {
      Process.waitpid job_pid
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dca-0.1.1 spec/job_spec.rb
dca-0.1.0 spec/job_spec.rb