aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/lib/active_job/queue_adapter.rb
diff options
context:
space:
mode:
authorAbdelkader Boudih <terminale@gmail.com>2014-08-26 20:08:49 +0000
committerAbdelkader Boudih <terminale@gmail.com>2014-09-02 07:50:16 +0000
commiteb4245dd17ba66c0551f3d4ed841b471bcf01b91 (patch)
treeb79b4091e2a92d84bdbb042d67160f0b0e51b453 /activejob/lib/active_job/queue_adapter.rb
parent97e689a0d76daf9c208f96832b6d06db9491d569 (diff)
downloadrails-eb4245dd17ba66c0551f3d4ed841b471bcf01b91.tar.gz
rails-eb4245dd17ba66c0551f3d4ed841b471bcf01b91.tar.bz2
rails-eb4245dd17ba66c0551f3d4ed841b471bcf01b91.zip
[ActiveJob] TestCase
Diffstat (limited to 'activejob/lib/active_job/queue_adapter.rb')
-rw-r--r--activejob/lib/active_job/queue_adapter.rb33
1 files changed, 20 insertions, 13 deletions
diff --git a/activejob/lib/active_job/queue_adapter.rb b/activejob/lib/active_job/queue_adapter.rb
index 13c23abce4..c597093458 100644
--- a/activejob/lib/active_job/queue_adapter.rb
+++ b/activejob/lib/active_job/queue_adapter.rb
@@ -3,21 +3,28 @@ require 'active_support/core_ext/string/inflections'
module ActiveJob
module QueueAdapter
- mattr_reader(:queue_adapter) { ActiveJob::QueueAdapters::InlineAdapter }
+ extend ActiveSupport::Concern
- def queue_adapter=(name_or_adapter)
- @@queue_adapter = \
- case name_or_adapter
- when Symbol, String
- load_adapter(name_or_adapter)
- when Class
- name_or_adapter
- end
- end
+ module ClassMethods
+ delegate :performed_jobs, :performed_jobs=,
+ :enqueued_jobs, :enqueued_jobs=,
+ to: ActiveJob::QueueAdapters::TestAdapter
+ mattr_reader(:queue_adapter) { ActiveJob::QueueAdapters::InlineAdapter }
- private
- def load_adapter(name)
- "ActiveJob::QueueAdapters::#{name.to_s.camelize}Adapter".constantize
+ def queue_adapter=(name_or_adapter)
+ @@queue_adapter = \
+ case name_or_adapter
+ when Symbol, String
+ load_adapter(name_or_adapter)
+ when Class
+ name_or_adapter
+ end
end
+
+ private
+ def load_adapter(name)
+ "ActiveJob::QueueAdapters::#{name.to_s.camelize}Adapter".constantize
+ end
+ end
end
end \ No newline at end of file