Parent

Class/Module Index [+]

Quicksearch

Mocha::Configuration

Configuration settings.

Constants

DEFAULTS

Public Class Methods

allow(action, &block) click to toggle source

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
def allow(action, &block)
  change_config action, :allow, &block
end
allow?(action) click to toggle source

@private

# File lib/mocha/configuration.rb, line 25
def allow?(action)
  configuration[action] == :allow
end
prevent(action, &block) click to toggle source

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
def prevent(action, &block)
  change_config action, :prevent, &block
end
prevent?(action) click to toggle source

@private

# File lib/mocha/configuration.rb, line 51
def prevent?(action)
  configuration[action] == :prevent
end
reset_configuration() click to toggle source

@private

# File lib/mocha/configuration.rb, line 56
def reset_configuration
  @configuration = nil
end
warn_when(action, &block) click to toggle source

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
def warn_when(action, &block)
  change_config action, :warn, &block
end
warn_when?(action) click to toggle source

@private

# File lib/mocha/configuration.rb, line 38
def warn_when?(action)
  configuration[action] == :warn
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.