Module: Fakes

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

Defined Under Namespace

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

Constant Summary collapse

VERSION =
"1.0.22"

Instance Method Summary collapse

Instance Method Details

#arg_matchObject



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

def arg_match
  return Fakes::Matches
end

#fake(invocations = {}) ⇒ Object



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

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

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



24
25
26
27
28
# File 'lib/fakes.rb', line 24

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

#reset_fake_classesObject



29
30
31
# File 'lib/fakes.rb', line 29

def reset_fake_classes
  Fakes::ClassSwaps.instance.reset
end