Class: RSpec::Sidekiq::Matchers::JobOptionParser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job) ⇒ JobOptionParser

Returns a new instance of JobOptionParser.



16
17
18
# File 'lib/rspec/sidekiq/matchers/have_enqueued_job.rb', line 16

def initialize(job)
  @job = job
end

Instance Attribute Details

#jobObject (readonly)

Returns the value of attribute job.



14
15
16
# File 'lib/rspec/sidekiq/matchers/have_enqueued_job.rb', line 14

def job
  @job
end

Instance Method Details

#matches?(option, value) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (ArgumentError)


20
21
22
23
# File 'lib/rspec/sidekiq/matchers/have_enqueued_job.rb', line 20

def matches?(option, value)
  raise ArgumentError, "Option `#{option}` is not defined." unless %w(in at).include?(option.to_s)
  send("#{option}_evaluator", value)
end