module RSpecCandy::Helpers::StubExisting

Public Instance Methods

stub_existing(attrs) click to toggle source
# File lib/rspec_candy/helpers/stub_existing.rb, line 5
def stub_existing(attrs)
  attrs.each do |method, value|
    if respond_to?(method, true)
      stub(method => value)
    else
      raise "Attempted to stub non-existing method ##{method} on #{inspect}"
    end
  end
end