Sha256: ead7fefa66d9bea6c7d9906aeb689270622f9925041999dab284caa48a2be294
Contents?: true
Size: 1009 Bytes
Versions: 8
Compression:
Stored size: 1009 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 source = CallerFilter.first_non_rspec_line Kernel.warn("An expectation of :#{method_name} was set on nil. Called from #{source}. Use allow_message_expectations_on_nil to disable warnings.") end end end end
Version data entries
8 entries across 8 versions & 1 rubygems