Sha256: 0386b439cad247bc5a642c5f0fedd06803611d309acfb8f91877019fcdcf3b68

Contents?: true

Size: 716 Bytes

Versions: 11

Compression:

Stored size: 716 Bytes

Contents

require 'minitest/autorun'
require 'active_record'
require 'mysql2'
require 'benchmark'
require 'jobs'

class WorkhorseTest < ActiveSupport::TestCase
  def setup
    Workhorse::DbJob.delete_all
  end

  protected

  def work(time = 2, options = {})
    options[:pool_size] ||= 5
    options[:polling_interval] ||= 1

    with_worker(options) do
      sleep time
    end
  end

  def with_worker(options = {})
    w = Workhorse::Worker.new(options)
    w.start
    begin
      yield(w)
    ensure
      w.shutdown
    end
  end
end

ActiveRecord::Base.establish_connection adapter: 'mysql2', database: 'workhorse', username: 'travis', password: '', pool: 10, host: :localhost

require 'db_schema'
require 'workhorse'

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
workhorse-0.3.9 test/lib/test_helper.rb
workhorse-0.3.8 test/lib/test_helper.rb
workhorse-0.3.7 test/lib/test_helper.rb
workhorse-0.3.6 test/lib/test_helper.rb
workhorse-0.3.5 test/lib/test_helper.rb
workhorse-0.3.4 test/lib/test_helper.rb
workhorse-0.3.3 test/lib/test_helper.rb
workhorse-0.3.2 test/lib/test_helper.rb
workhorse-0.3.1 test/lib/test_helper.rb
workhorse-0.3.0 test/lib/test_helper.rb
workhorse-0.2.0 test/lib/test_helper.rb