class RSpec::Mocks::ProxyForNil

@private

Attributes

warn_about_expectations[RW]
warn_about_expectations?[RW]

Public Class Methods

new(order_group) click to toggle source
Calls superclass method RSpec::Mocks::Proxy.new
# File lib/rspec/mocks/proxy.rb, line 400
def initialize(order_group)
  @warn_about_expectations = true
  super(nil, order_group)
end

Public Instance Methods

add_message_expectation(method_name, opts={}, &block) click to toggle source
# File lib/rspec/mocks/proxy.rb, line 408
def add_message_expectation(method_name, opts={}, &block)
  warn(method_name) if warn_about_expectations?
  super
end
add_negative_message_expectation(location, method_name, &implementation) click to toggle source
Calls superclass method
# File lib/rspec/mocks/proxy.rb, line 413
def add_negative_message_expectation(location, method_name, &implementation)
  warn(method_name) if warn_about_expectations?
  super
end
add_stub(method_name, opts={}, &implementation) click to toggle source
Calls superclass method RSpec::Mocks::Proxy#add_stub
# File lib/rspec/mocks/proxy.rb, line 418
def add_stub(method_name, opts={}, &implementation)
  warn(method_name) if warn_about_expectations?
  super
end

Private Instance Methods

warn(method_name) click to toggle source
# File lib/rspec/mocks/proxy.rb, line 425
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