class RSpec::Mocks::ProxyForNil
@private
Attributes
disallow_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 464 def initialize(order_group) set_expectation_behavior super(nil, order_group) end
Public Instance Methods
add_message_expectation(method_name, opts={}, &block)
click to toggle source
Calls superclass method
RSpec::Mocks::Proxy#add_message_expectation
# File lib/rspec/mocks/proxy.rb, line 472 def add_message_expectation(method_name, opts={}, &block) warn_or_raise!(method_name) 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 477 def add_stub(method_name, opts={}, &implementation) warn_or_raise!(method_name) super end
Private Instance Methods
raise_error(method_name)
click to toggle source
# File lib/rspec/mocks/proxy.rb, line 514 def raise_error(method_name) @error_generator.raise_expectation_on_nil_error(method_name) end
set_expectation_behavior()
click to toggle source
# File lib/rspec/mocks/proxy.rb, line 484 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
warn(method_name)
click to toggle source
# File lib/rspec/mocks/proxy.rb, line 509 def warn(method_name) warning_msg = @error_generator.expectation_on_nil_message(method_name) RSpec.warning(warning_msg) end
warn_or_raise!(method_name)
click to toggle source
# File lib/rspec/mocks/proxy.rb, line 498 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