class RSpec::Mocks::Configuration
Provides configuration options for rspec-mocks.
def add_stub_and_should_receive_to(*modules)
end
end
mocks.add_stub_and_should_receive_to Delegator
rspec.mock_with :rspec do |mocks|
RSpec.configure do |rspec|
@example
the process.
methods and remove `stub` and `should_receive` in
"strip themselves down" to a bare minimum set of
if you application uses some proxy classes that
modules or classes. This is usually only necessary
Adds `stub` and `should_receive` to the given
def add_stub_and_should_receive_to(*modules) modules.each do |mod| Syntax.enable_should(mod) end end
def initialize
def initialize @yield_receiver_to_any_instance_implementation_blocks = true @verify_doubled_constant_names = false @transfer_nested_constants = false @verify_partial_doubles = false end
def reset_syntaxes_to_default
- Api: - private
def reset_syntaxes_to_default self.syntax = [:should, :expect] RSpec::Mocks::Syntax.warn_about_should! end
def syntax
def syntax syntaxes = [] syntaxes << :should if Syntax.should_enabled? syntaxes << :expect if Syntax.expect_enabled? syntaxes end
def syntax=(values)
def syntax=(values) if Array(values).include?(:expect) Syntax.enable_expect else Syntax.disable_expect end if Array(values).include?(:should) Syntax.enable_should else Syntax.disable_should end end
def transfer_nested_constants=(val)
Sets the default for the `transfer_nested_constants` option when
def transfer_nested_constants=(val) @transfer_nested_constants = val end
def transfer_nested_constants?
def transfer_nested_constants? !!@transfer_nested_constants end
def verify_doubled_constant_names=(val)
test suite, with all production code loaded. Setting this for an
constant. You probably only want to set this when running your entire
`instance_double` or `class_double` is given the name of an undefined
When this is set to true, an error will be raised when
def verify_doubled_constant_names=(val) @verify_doubled_constant_names = val end
def verify_doubled_constant_names?
def verify_doubled_constant_names? !!@verify_doubled_constant_names end
def verify_partial_doubles=(val)
doubles. Any stubs will have their arity checked against the original
When set to true, partial mocks will be verified the same as object
def verify_partial_doubles=(val) @verify_partial_doubles = !!val end
def verify_partial_doubles?
def verify_partial_doubles? @verify_partial_doubles end
def yield_receiver_to_any_instance_implementation_blocks=(arg)
def yield_receiver_to_any_instance_implementation_blocks=(arg) @yield_receiver_to_any_instance_implementation_blocks = arg end
def yield_receiver_to_any_instance_implementation_blocks?
def yield_receiver_to_any_instance_implementation_blocks? @yield_receiver_to_any_instance_implementation_blocks end