Class: Bogus::MultiStubber

Inherits:
Object
  • Object
show all
Extended by:
Takes
Defined in:
lib/bogus/stubbing/multi_stubber.rb

Instance Method Summary collapse

Methods included from Takes

takes

Instance Method Details

#stub_all(object, methods = {}) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/bogus/stubbing/multi_stubber.rb', line 6

def stub_all(object, methods = {})
  double = create_double.call(object)
  methods.each do |name, result|
    block = result.is_a?(Proc) ? result : proc{ result }
    double.stubs(name, Bogus::AnyArgs, &block)
  end
  object
end