Class: Fakes::IgnoreSet

Inherits:
Object
  • Object
show all
Includes:
ArgBehaviour
Defined in:
lib/fakes/ignore_set.rb

Instance Attribute Summary

Attributes included from ArgBehaviour

#arg_matcher, #callback_block, #return_value, #times_called

Instance Method Summary collapse

Methods included from ArgBehaviour

#and_return, #initialize_matcher_using, #process, #run, #throws

Constructor Details

#initializeIgnoreSet

Returns a new instance of IgnoreSet.



5
6
7
# File 'lib/fakes/ignore_set.rb', line 5

def initialize
  @times_called = 0
end

Instance Method Details

#arg_setsObject



9
10
11
# File 'lib/fakes/ignore_set.rb', line 9

def arg_sets
  @arg_sets ||= []
end

#capture_args(args) ⇒ Object



13
14
15
16
# File 'lib/fakes/ignore_set.rb', line 13

def capture_args(args)
  @times_called += 1
  self.arg_sets << args
end

#matches?(args) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/fakes/ignore_set.rb', line 18

def matches?(args)
  return true
end

#was_called_with?(args) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/fakes/ignore_set.rb', line 22

def was_called_with?(args)
  matcher = ArgMatchFactory.create_arg_matcher_using(args)
  return self.arg_sets.select{|set| matcher.matches?(set)}.count > 0
end