Sha256: af73dab3ee7212cd3a612c3935125169681d7f173ab032bc9485b7a51bf3756d
Contents?: true
Size: 768 Bytes
Versions: 6
Compression:
Stored size: 768 Bytes
Contents
module Spec module Mocks class Mock include MockMethods # Creates a new mock with a +name+ (that will be used in error messages only) # Options: # * <tt>:null_object</tt> - if true, the mock object acts as a forgiving null object allowing any message to be sent to it. def initialize(name, options={}) @name = name @options = options end def method_missing(sym, *args, &block) __mock_handler.instance_eval {@messages_received << [sym, args, block]} begin return self if __mock_handler.null_object? super(sym, *args, &block) rescue NoMethodError __mock_handler.raise_unexpected_message_error sym, *args end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems