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.



147
148
149
# File 'lib/rspec/sidekiq/matchers/base.rb', line 147

def initialize(job)
  @job = job
end

Instance Attribute Details

#jobObject (readonly)

Returns the value of attribute job.



144
145
146
# File 'lib/rspec/sidekiq/matchers/base.rb', line 144

def job
  @job
end

Instance Method Details

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



171
172
173
174
175
# File 'lib/rspec/sidekiq/matchers/base.rb', line 171

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

  jid == other.jid
end

#argsObject



155
156
157
# File 'lib/rspec/sidekiq/matchers/base.rb', line 155

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

#contextObject



159
160
161
# File 'lib/rspec/sidekiq/matchers/base.rb', line 159

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

#jidObject



151
152
153
# File 'lib/rspec/sidekiq/matchers/base.rb', line 151

def jid
  job["jid"]
end

#matches_arguments?(expected_args) ⇒ Boolean

Returns:

  • (Boolean)


163
164
165
# File 'lib/rspec/sidekiq/matchers/base.rb', line 163

def matches_arguments?(expected_args)
  job_arguments.matches?(expected_args)
end

#matches_options?(expected_options) ⇒ Boolean

Returns:

  • (Boolean)


167
168
169
# File 'lib/rspec/sidekiq/matchers/base.rb', line 167

def matches_options?(expected_options)
  job_option_parser.matches?(expected_options)
end