Module: RSpec::Mocks::Methods

Defined in:
lib/rspec/mocks-call-through.rb

Instance Method Summary collapse

Instance Method Details

#stub(sym_or_hash, opts = {}, &block) ⇒ Object Also known as: stub!



5
6
7
8
9
10
11
# File 'lib/rspec/mocks-call-through.rb', line 5

def stub(sym_or_hash, opts={}, &block)
  if Hash === sym_or_hash
    sym_or_hash.each {|method, value| live_stub(method).and_return value }
  else
    __mock_proxy.add_live_stub(caller(1)[0], sym_or_hash.to_sym, opts, &block)
  end
end