Class: RSpec::Sidekiq::Matchers::HaveEnqueuedJob
- Inherits:
-
Object
- Object
- RSpec::Sidekiq::Matchers::HaveEnqueuedJob
- Defined in:
- lib/rspec/sidekiq/matchers/have_enqueued_job.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(expected) ⇒ HaveEnqueuedJob
constructor
A new instance of HaveEnqueuedJob.
- #matches?(klass) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(expected) ⇒ HaveEnqueuedJob
Returns a new instance of HaveEnqueuedJob.
9 10 11 |
# File 'lib/rspec/sidekiq/matchers/have_enqueued_job.rb', line 9 def initialize expected @expected = expected end |
Instance Method Details
#description ⇒ Object
13 14 15 |
# File 'lib/rspec/sidekiq/matchers/have_enqueued_job.rb', line 13 def description "have an enqueued #{@klass} job with arguments #{@expected}" end |
#failure_message ⇒ Object
17 18 19 20 |
# File 'lib/rspec/sidekiq/matchers/have_enqueued_job.rb', line 17 def "expected to have an enqueued #{@klass} job with arguments #{@expected} but none found\n\n" + "found: #{@actual}" end |
#matches?(klass) ⇒ Boolean
22 23 24 25 26 |
# File 'lib/rspec/sidekiq/matchers/have_enqueued_job.rb', line 22 def matches? klass @klass = klass @actual = klass.jobs.map { |job| job["args"] } @actual.include? @expected end |
#negative_failure_message ⇒ Object
28 29 30 |
# File 'lib/rspec/sidekiq/matchers/have_enqueued_job.rb', line 28 def "expected to not have an enqueued #{@klass} job with arguments #{@expected}" end |