Class Mocha::Configuration
In: lib/mocha/configuration.rb
Parent: Object

Configuration settings

Methods

allow   prevent   warn_when  

Constants

DEFAULTS = { :stubbing_method_unnecessarily => :allow, :stubbing_method_on_non_mock_object => :allow, :stubbing_non_existent_method => :allow, :stubbing_non_public_method => :allow }

Public Class methods

Allow the specified action (as a symbol). The actions currently available are :stubbing_method_unnecessarily, :stubbing_method_on_non_mock_object, :stubbing_non_existent_method, :stubbing_non_public_method. If given a block, the configuration for the action will only be changed for the duration of the block, and will then be restored to the previous value.

[Source]

    # File lib/mocha/configuration.rb, line 15
15:       def allow(action, &block)
16:         change_config action, :allow, &block
17:       end

Raise a StubbingError if the specified action (as a symbol) is attempted. The actions currently available are :stubbing_method_unnecessarily, :stubbing_method_on_non_mock_object, :stubbing_non_existent_method, :stubbing_non_public_method. If given a block, the configuration for the action will only be changed for the duration of the block, and will then be restored to the previous value.

[Source]

    # File lib/mocha/configuration.rb, line 41
41:       def prevent(action, &block)
42:         change_config action, :prevent, &block
43:       end

Warn if the specified action (as a symbol) is attempted. The actions currently available are :stubbing_method_unnecessarily, :stubbing_method_on_non_mock_object, :stubbing_non_existent_method, :stubbing_non_public_method. If given a block, the configuration for the action will only be changed for the duration of the block, and will then be restored to the previous value.

[Source]

    # File lib/mocha/configuration.rb, line 28
28:       def warn_when(action, &block)
29:         change_config action, :warn, &block
30:       end

[Validate]