lib/fakes.rb in fakes-1.0.9 vs lib/fakes.rb in fakes-1.0.22
- old
+ new
@@ -1,17 +1,34 @@
-require 'fakes/arg_matching/arg_match_factory'
-require 'fakes/arg_matching/block_arg_matcher'
-require 'fakes/arg_matching/combined_arg_matcher'
-require 'fakes/arg_matching/matches'
-require 'fakes/arg_matching/regular_arg_matcher'
-require 'fakes/arg_behaviour'
-require 'fakes/arg_set'
-require 'fakes/class_swap'
-require 'fakes/class_swaps'
-require 'fakes/fake'
-require 'fakes/ignore_set'
-require 'fakes/method_stub'
-require 'fakes/fakes'
-
+require 'core/arg_matching/arg_match_factory'
+require 'core/arg_matching/block_arg_matcher'
+require 'core/arg_matching/combined_arg_matcher'
+require 'core/arg_matching/matches'
+require 'core/arg_matching/regular_arg_matcher'
+require 'core/arg_behaviour'
+require 'core/arg_set'
+require 'core/class_swap'
+require 'core/class_swaps'
+require 'core/fake'
+require 'core/ignore_set'
+require 'core/method_stub'
require 'singleton'
+
+module Fakes
+ def fake(invocations = {})
+ item = Fakes::Fake.new
+ invocations.each{|method,return_value| item.stub(method).and_return(return_value)}
+ item
+ end
+ def arg_match
+ return Fakes::Matches
+ end
+ def fake_class(klass,invocations = {})
+ item = fake(invocations)
+ Fakes::ClassSwaps.instance.add_fake_for(klass,item)
+ item
+ end
+ def reset_fake_classes
+ Fakes::ClassSwaps.instance.reset
+ end
+end
include Fakes