Class: RSpec::Sidekiq::Matchers::BeProcessedIn
- Inherits:
-
Object
- Object
- RSpec::Sidekiq::Matchers::BeProcessedIn
- Defined in:
- lib/rspec/sidekiq/matchers/be_processed_in.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(expected_queue) ⇒ BeProcessedIn
constructor
A new instance of BeProcessedIn.
- #matches?(job) ⇒ Boolean
Constructor Details
#initialize(expected_queue) ⇒ BeProcessedIn
Returns a new instance of BeProcessedIn.
9 10 11 |
# File 'lib/rspec/sidekiq/matchers/be_processed_in.rb', line 9 def initialize(expected_queue) @expected_queue = expected_queue end |
Instance Method Details
#description ⇒ Object
13 14 15 |
# File 'lib/rspec/sidekiq/matchers/be_processed_in.rb', line 13 def description "be processed in the \"#{@expected_queue}\" queue" end |
#failure_message ⇒ Object
17 18 19 |
# File 'lib/rspec/sidekiq/matchers/be_processed_in.rb', line 17 def "expected #{@klass} to be processed in the \"#{@expected_queue}\" queue but got \"#{@actual}\"" end |
#failure_message_when_negated ⇒ Object
31 32 33 |
# File 'lib/rspec/sidekiq/matchers/be_processed_in.rb', line 31 def "expected #{@klass} to not be processed in the \"#{@expected_queue}\" queue" end |
#matches?(job) ⇒ Boolean
21 22 23 24 25 26 27 28 29 |
# File 'lib/rspec/sidekiq/matchers/be_processed_in.rb', line 21 def matches?(job) @klass = job.is_a?(Class) ? job : job.class if @klass.methods.include?(:get_sidekiq_options) @actual = @klass.['queue'] else @actual = job.try(:queue_name) end @actual.to_s == @expected_queue.to_s end |