Sha256: 5a18bdfd4296416b28958716c69f08e05c27fafc79e696f30415a99723100c46
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
module SidekiqUniqueJobs module RSpec module InstanceMethods # enable versioning for specific blocks (at instance-level) def with_global_config(config) was_config = SidekiqUniqueJobs.config SidekiqUniqueJobs.configure(config) yield ensure SidekiqUniqueJobs.configure(was_config) end # enable versioning for specific blocks (at instance-level) def with_sidekiq_options_for(worker_class, options) worker_class = SidekiqUniqueJobs.worker_class_constantize(worker_class) if worker_class.respond_to?(:sidekiq_options) was_options = worker_class.get_sidekiq_options worker_class.sidekiq_options(options) end yield ensure worker_class.sidekiq_options_hash = was_options if worker_class.respond_to?(:sidekiq_options_hash=) end end module ClassMethods def with_sidekiq_options_for(worker_class, options = {}, &block) context "with sidekiq options #{options}" do around(:each) do |ex| with_sidekiq_options_for(worker_class, options, &ex) end class_exec(&block) end end # enable versioning for specific blocks (at class-level) def with_global_config(config = {}, &block) context "with global configuration #{config}" do around(:each) do |ex| with_global_config(config, &ex) end class_exec(&block) end end end end end RSpec.configure do |config| config.include SidekiqUniqueJobs::RSpec::InstanceMethods config.extend SidekiqUniqueJobs::RSpec::ClassMethods end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-unique-jobs-4.0.0 | spec/support/unique_macros.rb |