Method: Minitest::Moar::Stubbing#stub
- Defined in:
- lib/minitest/moar/stubbing.rb
#stub(klass, name, val_or_callable = nil, *block_args, &block) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/minitest/moar/stubbing.rb', line 2 def stub klass, name, val_or_callable = nil, *block_args, &block @invocations ||= Hash.new { |h, k| h[k] = Hash.new { |_h, _k| _h[_k] = 0 } } = class << klass; self; end if .respond_to? name and not .instance_methods.map(&:to_s).include? name.to_s then .send :define_method, name do |*args| super(*args) end end __stub__ , name, val_or_callable, block_args, &block end |