Sha256: a4c6450f379795e5deb3ac49dd034f3bd68db8b39c58d0c17a2c39201837f669
Contents?: true
Size: 950 Bytes
Versions: 1
Compression:
Stored size: 950 Bytes
Contents
class Class # removes all the modules from this class name def demodulize self.to_s.gsub(/^.*::/, '') end # indicates whether this type has a CLR type in its ancestors def clr_type? !self.to_clr_type.nil? || self.included_modules.any? {|mod| !mod.to_clr_type.nil? } || self.ancestors.reject {|mod| mod == Object }.any? { |mod| !mod.to_clr_type.nil? } end def isolate(name=nil, recorder = Caricature::MethodCallRecorder.new, expectations = Caricature::Expectations.new, &block) iso = Caricature::Isolation.for(self, recorder, expectations) return iso unless name if block if block.arity > 0 @expectation = iso.when_class_receives(name, &block) else @expectation = iso.when_class_receives(name) instance_eval &block end end iso end alias_method :when_receiving, :isolate alias_method :mock, :isolate alias_method :stub, :isolate end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
caricature-0.7.7 | lib/caricature/core_ext/class.rb |