Module: Fakes

Defined in:
lib/fakes/fake.rb,
lib/fakes/fakes.rb,
lib/fakes/arg_set.rb,
lib/fakes/version.rb,
lib/fakes/class_swap.rb,
lib/fakes/ignore_set.rb,
lib/fakes/class_swaps.rb,
lib/fakes/method_stub.rb,
lib/fakes/arg_behaviour.rb,
lib/fakes/arg_matching/arg_match_factory.rb,
lib/fakes/arg_matching/argument_matching.rb,
lib/fakes/arg_matching/block_arg_matcher.rb,
lib/fakes/arg_matching/regular_arg_matcher.rb,
lib/fakes/arg_matching/combined_arg_matcher.rb

Defined Under Namespace

Modules: ArgBehaviour, ArgumentMatching Classes: ArgMatchFactory, ArgSet, BlockArgMatcher, ClassSwap, ClassSwaps, CombinedArgMatcher, Fake, IgnoreSet, MethodStub, RegularArgMatcher

Constant Summary collapse

VERSION =
"1.1.6"

Instance Method Summary collapse

Instance Method Details

#arg_matchObject



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

def arg_match
  return ArgumentMatching
end

#fake(invocations = {}) ⇒ Object



2
3
4
5
6
# File 'lib/fakes/fakes.rb', line 2

def fake(invocations = {})
  item = Fake.new
  invocations.each{|method,return_value| item.stub(method).and_return(return_value)}
  item
end

#fake_class(klass, invocations = {}) ⇒ Object



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

def fake_class(klass,invocations = {})
  item = fake(invocations)
  ClassSwaps.instance.add_fake_for(klass,item)
  item
end

#reset_fake_classesObject



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

def reset_fake_classes
  ClassSwaps.instance.reset
end