Configuration settings.
Allow the specified action.
@param [Symbol] action one of :stubbing_method_unnecessarily, :stubbing_method_on_non_mock_object, :stubbing_non_existent_method, :stubbing_non_public_method, :stubbing_method_on_nil. @yield optional block during which the configuration change will be changed before being returned to its original value at the end of the block.
# File lib/mocha/configuration.rb, line 20 20: def allow(action, &block) 21: change_config action, :allow, &block 22: end
@private
# File lib/mocha/configuration.rb, line 25 25: def allow?(action) 26: configuration[action] == :allow 27: end
Raise a {StubbingError} if if the specified action is attempted.
@param [Symbol] action one of :stubbing_method_unnecessarily, :stubbing_method_on_non_mock_object, :stubbing_non_existent_method, :stubbing_non_public_method, :stubbing_method_on_nil. @yield optional block during which the configuration change will be changed before being returned to its original value at the end of the block.
# File lib/mocha/configuration.rb, line 46 46: def prevent(action, &block) 47: change_config action, :prevent, &block 48: end
@private
# File lib/mocha/configuration.rb, line 51 51: def prevent?(action) 52: configuration[action] == :prevent 53: end
@private
# File lib/mocha/configuration.rb, line 56 56: def reset_configuration 57: @configuration = nil 58: end
Warn if the specified action is attempted.
@param [Symbol] action one of :stubbing_method_unnecessarily, :stubbing_method_on_non_mock_object, :stubbing_non_existent_method, :stubbing_non_public_method, :stubbing_method_on_nil. @yield optional block during which the configuration change will be changed before being returned to its original value at the end of the block.
# File lib/mocha/configuration.rb, line 33 33: def warn_when(action, &block) 34: change_config action, :warn, &block 35: end
@private
# File lib/mocha/configuration.rb, line 68 68: def change_config(action, new_value, &block) 69: if block_given? 70: temporarily_change_config action, new_value, &block 71: else 72: configuration[action] = new_value 73: end 74: end
@private
# File lib/mocha/configuration.rb, line 63 63: def configuration 64: @configuration ||= DEFAULTS.dup 65: end
@private
# File lib/mocha/configuration.rb, line 77 77: def temporarily_change_config(action, new_value, &block) 78: original_value = configuration[action] 79: configuration[action] = new_value 80: yield 81: ensure 82: configuration[action] = original_value 83: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.