Class: SidekiqUniqueJobs::RSpec::Matchers::HaveValidSidekiqOptions
- Inherits:
-
Object
- Object
- SidekiqUniqueJobs::RSpec::Matchers::HaveValidSidekiqOptions
- Defined in:
- lib/sidekiq_unique_jobs/rspec/matchers/have_valid_sidekiq_options.rb
Overview
Class HaveValidSidekiqOptions validates the unique/lock configuration for a worker.
Instance Attribute Summary collapse
-
#lock_config ⇒ Object
readonly
Returns the value of attribute lock_config.
-
#sidekiq_options ⇒ Object
readonly
Returns the value of attribute sidekiq_options.
-
#worker ⇒ Object
readonly
Returns the value of attribute worker.
Instance Method Summary collapse
-
#description ⇒ Object
:nodoc:.
-
#failure_message ⇒ Object
:nodoc:.
- #matches?(worker) ⇒ Boolean
Instance Attribute Details
#lock_config ⇒ Object (readonly)
Returns the value of attribute lock_config.
17 18 19 |
# File 'lib/sidekiq_unique_jobs/rspec/matchers/have_valid_sidekiq_options.rb', line 17 def lock_config @lock_config end |
#sidekiq_options ⇒ Object (readonly)
Returns the value of attribute sidekiq_options.
17 18 19 |
# File 'lib/sidekiq_unique_jobs/rspec/matchers/have_valid_sidekiq_options.rb', line 17 def @sidekiq_options end |
#worker ⇒ Object (readonly)
Returns the value of attribute worker.
17 18 19 |
# File 'lib/sidekiq_unique_jobs/rspec/matchers/have_valid_sidekiq_options.rb', line 17 def worker @worker end |
Instance Method Details
#description ⇒ Object
:nodoc:
35 36 37 |
# File 'lib/sidekiq_unique_jobs/rspec/matchers/have_valid_sidekiq_options.rb', line 35 def description "have valid sidekiq options" end |
#failure_message ⇒ Object
:nodoc:
27 28 29 30 31 32 |
# File 'lib/sidekiq_unique_jobs/rspec/matchers/have_valid_sidekiq_options.rb', line 27 def <<~FAILURE_MESSAGE Expected #{worker} to have valid sidekiq options but found the following problems: #{lock_config.errors_as_string} FAILURE_MESSAGE end |
#matches?(worker) ⇒ Boolean
19 20 21 22 23 24 |
# File 'lib/sidekiq_unique_jobs/rspec/matchers/have_valid_sidekiq_options.rb', line 19 def matches?(worker) @worker = worker @sidekiq_options = worker. @lock_config = SidekiqUniqueJobs.validate_worker() lock_config.valid? end |