Module: Fakes::ArgumentMatching

Extended by:
ArgumentMatching
Included in:
ArgumentMatching
Defined in:
lib/fakes/arg_matching/argument_matching.rb

Instance Method Summary collapse

Instance Method Details

#anyObject



13
14
15
# File 'lib/fakes/arg_matching/argument_matching.rb', line 13

def any
  condition { |ignored| true }
end

#condition(&conditional_block) ⇒ Object



30
31
32
# File 'lib/fakes/arg_matching/argument_matching.rb', line 30

def condition(&conditional_block)
  return BlockArgMatcher.new(conditional_block)
end

#greater_than(value) ⇒ Object



17
18
19
# File 'lib/fakes/arg_matching/argument_matching.rb', line 17

def greater_than(value)
  condition { |number| number > value }
end

#in_range(range) ⇒ Object



22
23
24
# File 'lib/fakes/arg_matching/argument_matching.rb', line 22

def in_range(range)
  condition { |item| range === item }
end

#nilObject



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

def nil
  condition { |item| item == nil }
end

#not_nilObject



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

def not_nil
  condition { |item| item != nil }
end

#regex(pattern) ⇒ Object



26
27
28
# File 'lib/fakes/arg_matching/argument_matching.rb', line 26

def regex(pattern)
  condition { |string_argument| pattern =~ string_argument }
end