Class: RSpec::Que::Matchers::QueueUp::QueuedArgs

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/que/queue_up/queued_args.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ QueuedArgs

Returns a new instance of QueuedArgs.



8
9
10
11
# File 'lib/rspec/que/queue_up/queued_args.rb', line 8

def initialize(args)
  @args = args
  @argument_list_matcher = RSpec::Mocks::ArgumentListMatcher.new(*args)
end

Instance Method Details

#descObject



17
18
19
# File 'lib/rspec/que/queue_up/queued_args.rb', line 17

def desc
  "with args #{@args}"
end

#failed_msg(candidates) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/rspec/que/queue_up/queued_args.rb', line 21

def failed_msg(candidates)
  if candidates.length == 1
    "job enqueued with #{candidates.first[:args]}"
  else
    "#{candidates.length} jobs with args: " +
      candidates.map { |j| j[:args] }.to_s
  end
end

#matches?(job) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/rspec/que/queue_up/queued_args.rb', line 13

def matches?(job)
  @argument_list_matcher.args_match?(*job[:args])
end