Sha256: 2b323e0bf5ac8a09f61302a6bda1f21ee97e3af6f9b1e6bf13fac0d5390edd45
Contents?: true
Size: 961 Bytes
Versions: 1
Compression:
Stored size: 961 Bytes
Contents
module RSpec module Mocks # @private class ProxyForNil < Proxy def initialize @warn_about_expectations = true super nil end attr_accessor :warn_about_expectations alias warn_about_expectations? warn_about_expectations def add_message_expectation(location, method_name, opts={}, &block) warn(method_name) if warn_about_expectations? super end def add_negative_message_expectation(location, method_name, &implementation) warn(method_name) if warn_about_expectations? super end def add_stub(location, method_name, opts={}, &implementation) warn(method_name) if warn_about_expectations? super end private def warn method_name Kernel.warn("An expectation of :#{method_name} was set on nil. Called from #{caller[2]}. Use allow_message_expectations_on_nil to disable warnings.") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rspec-mocks-2.14.0.rc1 | lib/rspec/mocks/proxy_for_nil.rb |