Class: Fakes::IgnoreSet

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

Instance Attribute Summary

Attributes included from ArgBehaviour

#return_value, #times_called

Instance Method Summary collapse

Methods included from ArgBehaviour

#and_return, #capture_args

Constructor Details

#initializeIgnoreSet

Returns a new instance of IgnoreSet.



5
6
7
8
9
10
11
12
13
# File 'lib/fakes/ignore_set.rb', line 5

def initialize
  array :arg_sets do|a|
    a.mutator :capture_args do|args|
      @times_called += 1
      @arg_sets << args
    end
  end
  @times_called = 0
end

Instance Method Details

#matches?(args) ⇒ Boolean

Returns:

  • (Boolean)


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

def matches?(args)
  return true
end

#was_called_with?(args) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/fakes/ignore_set.rb', line 20

def was_called_with?(args)
  return @arg_sets.select{|set| set == args}.count > 0
end