Class: RSpec::Sidekiq::Matchers::BeProcessedIn

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/sidekiq/matchers/be_processed_in.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected) ⇒ BeProcessedIn

Returns a new instance of BeProcessedIn.



9
10
11
# File 'lib/rspec/sidekiq/matchers/be_processed_in.rb', line 9

def initialize expected
  @expected = expected
end

Instance Method Details

#descriptionObject



13
14
15
# File 'lib/rspec/sidekiq/matchers/be_processed_in.rb', line 13

def description
  "be processed in the \"#{@expected}\" queue"
end

#failure_messageObject



17
18
19
# File 'lib/rspec/sidekiq/matchers/be_processed_in.rb', line 17

def failure_message
  "expected #{@klass} to be processed in the #{@expected} queue but got #{@actual}"
end

#matches?(job) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
# File 'lib/rspec/sidekiq/matchers/be_processed_in.rb', line 21

def matches? job
  @klass = job.class
  @actual = @klass.get_sidekiq_options["queue"]
  @actual == @expected
end

#negative_failure_messageObject



27
28
29
# File 'lib/rspec/sidekiq/matchers/be_processed_in.rb', line 27

def negative_failure_message
  "expected #{@klass} to not be processed in the #{@expected} queue"
end