Method: Object#stub_methods_to_raise

Defined in:
lib/not_a_mock/object_extensions.rb

#stub_methods_to_raise(methods) ⇒ Object Also known as: stub_method_to_raise

Takes a hash of method names mapped to exceptions, and replaces each named method on this object with a stub version returning the corresponding exception.



64
65
66
67
68
# File 'lib/not_a_mock/object_extensions.rb', line 64

def stub_methods_to_raise(methods)
  methods.each do |method, exception|
    stub_method(method) {|*args| raise exception }
  end
end