Sha256: 80aff891e2f29af506f4f79755766d88fe230357d8ee944f2d7da1a0af1d1d8b

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

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

class AsyncUser; def self.invoke_hook_events(*args); true; end; end

describe "Backburner::AsyncProxy class" do
  before do
    Backburner.default_queues.clear
  end

  after do
    clear_jobs!("async-user")
  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
      job, body = pop_one_job("async-user")
      assert_equal "AsyncUser", body["class"]
      assert_equal [10, "foo"], body["args"]
      assert_equal 100, job.ttr
      assert_equal 1000, job.pri
      job.delete
    end

    should "enqueue job onto worker with args" do
      @async = Backburner::AsyncProxy.new(AsyncUser, 10, :pri => 1000, :ttr => 100)
      @async.bar(1, 2, 3)
      job, body = pop_one_job("async-user")
      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 # method_missing
end # AsyncProxy

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
backburner-0.3.4 test/async_proxy_test.rb
backburner-0.3.3 test/async_proxy_test.rb
backburner-0.3.2 test/async_proxy_test.rb
backburner-0.3.1 test/async_proxy_test.rb
backburner-0.3.0 test/async_proxy_test.rb