Class RSpec::Mocks::ConstantStubber
In: lib/rspec/mocks/stub_const.rb
Parent: Object

Provides a means to stub constants.

Methods

Classes and Modules

Class RSpec::Mocks::ConstantStubber::BaseStubber
Class RSpec::Mocks::ConstantStubber::DefinedConstantReplacer
Class RSpec::Mocks::ConstantStubber::UndefinedConstantSetter

Public Class methods

Ensures the constant stubbing is registered with rspec-mocks space so that stubbed constants can be restored when examples finish.

@api private

Used internally by the constant stubbing to raise a helpful error when a constant like "A::B::C" is stubbed and A::B is not a module (and thus, it‘s impossible to define "A::B::C" since only modules can have nested constants).

@api private

Resets all stubbed constants. This is called automatically by rspec-mocks when an example finishes.

@api private

Stubs a constant.

@param (see ExampleMethods#stub_const) @option (see ExampleMethods#stub_const) @return (see ExampleMethods#stub_const)

@see ExampleMethods#stub_const @note It‘s recommended that you use `stub_const` in your

 examples. This is an alternate public API that is provided
 so you can stub constants in other contexts (e.g. helper
 classes).

The list of constant stubbers that have been used for the current example.

@api private

[Validate]