test/backgrounded/handler/resque_handler_test.rb in backgrounded-0.7.0 vs test/backgrounded/handler/resque_handler_test.rb in backgrounded-0.7.1

- old
+ new

@@ -1,7 +1,8 @@ require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') require 'backgrounded/handler/resque_handler' +require 'resque_unit' ActiveRecord::Schema.define(:version => 1) do create_table :users, :force => true do |t| t.column :name, :string end @@ -46,11 +47,11 @@ context "invoking backgrounded method" do setup do Blog.do_stuff_backgrounded end should "enqueue job to resque" do - assert_queued Backgrounded::Handler::ResqueHandler + assert_queued Backgrounded::Handler::ResqueHandler, [Blog.to_s, -1, 'do_stuff'] assert_equal Backgrounded::Handler::ResqueHandler::DEFAULT_QUEUE, Resque.queue_from_class(Backgrounded::Handler::ResqueHandler) end context "running background job" do setup do Blog.expects(:do_stuff) @@ -68,11 +69,11 @@ context "invoking backgrounded method" do setup do @user.do_stuff_backgrounded end should "enqueue job to resque" do - assert_queued Backgrounded::Handler::ResqueHandler + assert_queued Backgrounded::Handler::ResqueHandler, [User.to_s, @user.id, 'do_stuff'] assert_equal Backgrounded::Handler::ResqueHandler::DEFAULT_QUEUE, Resque.queue_from_class(Backgrounded::Handler::ResqueHandler) end context "running background job" do should "invoke method on user object" do User.any_instance.expects(:do_stuff) @@ -90,9 +91,10 @@ @post.do_stuff_backgrounded end should "use configured queue" do assert_equal 'important', Backgrounded::Handler::ResqueHandler.queue assert_equal 'important', Resque.queue_from_class(Backgrounded::Handler::ResqueHandler) + assert_equal 1, Resque.queue('important').length end end end end end