Class: RSpec::Sidekiq::Matchers::EnqueuedJob

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/rspec/sidekiq/matchers/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job) ⇒ EnqueuedJob

Returns a new instance of EnqueuedJob.



89
90
91
# File 'lib/rspec/sidekiq/matchers/base.rb', line 89

def initialize(job)
  @job = job
end

Instance Attribute Details

#jobObject (readonly)

Returns the value of attribute job.



86
87
88
# File 'lib/rspec/sidekiq/matchers/base.rb', line 86

def job
  @job
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



105
106
107
108
109
# File 'lib/rspec/sidekiq/matchers/base.rb', line 105

def ==(other)
  super(other) unless other.is_a?(EnqueuedJob)

  jid == other.jid
end

#argsObject



97
98
99
# File 'lib/rspec/sidekiq/matchers/base.rb', line 97

def args
  @args ||= JobArguments.new(job).unwrapped_arguments
end

#contextObject



101
102
103
# File 'lib/rspec/sidekiq/matchers/base.rb', line 101

def context
  @context ||= job.except("args")
end

#jidObject



93
94
95
# File 'lib/rspec/sidekiq/matchers/base.rb', line 93

def jid
  job["jid"]
end