class RSpec::Mocks::ProxyForNil
@private
Attributes
Public Class Methods
Source
# File lib/rspec/mocks/proxy.rb, line 462 def initialize(order_group) set_expectation_behavior super(nil, order_group) end
Calls superclass method
RSpec::Mocks::Proxy::new
Public Instance Methods
Source
# File lib/rspec/mocks/proxy.rb, line 470 def add_message_expectation(method_name, opts={}, &block) warn_or_raise!(method_name) super end
Calls superclass method
RSpec::Mocks::Proxy#add_message_expectation
Source
# File lib/rspec/mocks/proxy.rb, line 475 def add_stub(method_name, opts={}, &implementation) warn_or_raise!(method_name) super end
Calls superclass method
RSpec::Mocks::Proxy#add_stub
Private Instance Methods
Source
# File lib/rspec/mocks/proxy.rb, line 512 def raise_error(method_name) @error_generator.raise_expectation_on_nil_error(method_name) end
Source
# File lib/rspec/mocks/proxy.rb, line 482 def set_expectation_behavior case RSpec::Mocks.configuration.allow_message_expectations_on_nil when false @warn_about_expectations = false @disallow_expectations = true when true @warn_about_expectations = false @disallow_expectations = false else @warn_about_expectations = true @disallow_expectations = false end end
Source
# File lib/rspec/mocks/proxy.rb, line 507 def warn(method_name) warning_msg = @error_generator.expectation_on_nil_message(method_name) RSpec.warning(warning_msg) end
Source
# File lib/rspec/mocks/proxy.rb, line 496 def warn_or_raise!(method_name) # This method intentionally swallows the message when # neither disallow_expectations nor warn_about_expectations # are set to true. if disallow_expectations raise_error(method_name) elsif warn_about_expectations warn(method_name) end end