Sha256: fd9ddd6aef083243a6bb88107501f0c58bbaa0dd71390ad0b61ae390333646c8

Contents?: true

Size: 1.08 KB

Versions: 53

Compression:

Stored size: 1.08 KB

Contents

require File.expand_path('../test_helper', __FILE__)

class AsyncUser; end

describe "Backburner::AsyncProxy class" do
  before do
    Backburner.default_queues.clear
    clear_jobs!(Backburner.configuration.primary_queue)
  end

  describe "for method_missing enqueue" do
    should "enqueue job onto worker with no args" do
      @async = Backburner::AsyncProxy.new(AsyncUser, 10, :pri => 1000, :ttr => 100)
      @async.foo
      pop_one_job do |job, body|
        assert_equal "AsyncUser", body["class"]
        assert_equal [10, "foo"], body["args"]
        assert_equal 100, job.ttr
        assert_equal 1000, job.pri
        job.delete
      end
    end

    should "enqueue job onto worker with args" do
      @async = Backburner::AsyncProxy.new(AsyncUser, 10, :pri => 1000, :ttr => 100)
      @async.bar(1, 2, 3)
      pop_one_job do |job, body|
        assert_equal "AsyncUser", body["class"]
        assert_equal [10, "bar", 1, 2, 3], body["args"]
        assert_equal 100, job.ttr
        assert_equal 1000, job.pri
        job.delete
      end
    end
  end # method_missing
end # AsyncProxy

Version data entries

53 entries across 53 versions & 2 rubygems

Version Path
backburner-allq-1.0.28 test/async_proxy_test.rb
backburner-allq-1.0.27 test/async_proxy_test.rb
backburner-allq-1.0.26 test/async_proxy_test.rb
backburner-allq-1.0.25 test/async_proxy_test.rb
backburner-allq-1.0.24 test/async_proxy_test.rb
backburner-allq-1.0.23 test/async_proxy_test.rb
backburner-allq-1.0.22 test/async_proxy_test.rb
backburner-allq-1.0.21 test/async_proxy_test.rb
backburner-allq-1.0.20 test/async_proxy_test.rb
backburner-allq-1.0.19 test/async_proxy_test.rb
backburner-allq-1.0.18 test/async_proxy_test.rb
backburner-allq-1.0.17 test/async_proxy_test.rb
backburner-allq-1.0.16 test/async_proxy_test.rb
backburner-allq-1.0.14 test/async_proxy_test.rb
backburner-allq-1.0.13 test/async_proxy_test.rb
backburner-allq-1.0.12 test/async_proxy_test.rb
backburner-allq-1.0.11 test/async_proxy_test.rb
backburner-allq-1.0.9 test/async_proxy_test.rb
backburner-allq-1.0.8 test/async_proxy_test.rb
backburner-allq-1.0.7 test/async_proxy_test.rb