diff --git a/Changes.md b/Changes.md index 8484a0d7..a5e4f1e2 100644 --- a/Changes.md +++ b/Changes.md @@ -26,7 +26,7 @@ end - Fix delayed extensions not available in workers [#152] -- In test environments add the `#perform` class method to workers. This method +- In test environments add the `#drain` class method to workers. This method executes all previously queued jobs. (panthomakos) 1.1.4 diff --git a/lib/sidekiq/testing.rb b/lib/sidekiq/testing.rb index 4de02092..192c1bac 100644 --- a/lib/sidekiq/testing.rb +++ b/lib/sidekiq/testing.rb @@ -34,7 +34,7 @@ module Sidekiq @pushed ||= [] end - def perform + def drain while job = jobs.shift do new.perform(*job['args']) end diff --git a/test/test_testing.rb b/test/test_testing.rb index 8f0b746f..65c24899 100644 --- a/test/test_testing.rb +++ b/test/test_testing.rb @@ -89,7 +89,7 @@ class TestTesting < MiniTest::Unit::TestCase assert_equal 2, StoredWorker.jobs.size assert_raises PerformError do - StoredWorker.perform + StoredWorker.drain end assert_equal 0, StoredWorker.jobs.size end