Sha256: ab4aca2dfd525338c5a8b646071f49942f4ecc29a4d34eedfdb7e82cc4238a58
Contents?: true
Size: 844 Bytes
Versions: 4
Compression:
Stored size: 844 Bytes
Contents
module Fakes class Fake def initialize(invocation_set = {}) @method_invocations = invocation_set end def method_missing(name,*args,&block) return @method_invocations.has_key?(name.to_sym) ? @method_invocations[name.to_sym].invoke(args) : handle_unexpected_method_invocation(name,args,block) end def respond_to?(method_symbol) return true end def handle_unexpected_method_invocation(name,args,block) method = stub(name.to_sym) method.ignore_arg return method.invoke(args) end def stub(symbol) return @method_invocations[symbol] || @method_invocations[symbol] = MethodStub.new end def received(symbol) return @method_invocations[symbol] end def never_received?(symbol) return !@method_invocations.has_key?(symbol) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
fakes-0.1.7 | lib/fakes/fake.rb |
fakes-0.1.6 | lib/fakes/fake.rb |
fakes-0.1.5 | lib/fakes/fake.rb |
fakes-0.1.4 | lib/fakes/fake.rb |