Module: Mocha

Defined in:
lib/mocha/api.rb,
lib/mocha/hooks.rb,
lib/mocha/mock.rb,
lib/mocha/expectation.rb,
lib/mocha/object_methods.rb,
lib/mocha/class_methods.rb,
lib/mocha/parameter_matchers.rb,
lib/mocha/parameter_matchers/not.rb,
lib/mocha/parameter_matchers/base.rb,
lib/mocha/parameter_matchers/is_a.rb,
lib/mocha/parameter_matchers/all_of.rb,
lib/mocha/parameter_matchers/any_of.rb,
lib/mocha/parameter_matchers/equals.rb,
lib/mocha/parameter_matchers/has_key.rb,
lib/mocha/parameter_matchers/kind_of.rb,
lib/mocha/parameter_matchers/anything.rb,
lib/mocha/parameter_matchers/has_keys.rb,
lib/mocha/parameter_matchers/includes.rb,
lib/mocha/parameter_matchers/has_entry.rb,
lib/mocha/parameter_matchers/has_value.rb,
lib/mocha/parameter_matchers/optionally.rb,
lib/mocha/parameter_matchers/has_entries.rb,
lib/mocha/parameter_matchers/instance_of.rb,
lib/mocha/parameter_matchers/responds_with.rb,
lib/mocha/parameter_matchers/any_parameters.rb,
lib/mocha/parameter_matchers/equivalent_uri.rb,
lib/mocha/parameter_matchers/regexp_matches.rb,
lib/mocha/parameter_matchers/yaml_equivalent.rb,
lib/mocha/parameter_matchers/instance_methods.rb,
lib/mocha/parameter_matchers/positional_or_keyword_hash.rb,
lib/mocha/state_machine.rb,
lib/mocha/sequence.rb,
lib/mocha/configuration.rb,
lib/mocha/expectation_error_factory.rb,
lib/mocha/expectation_error.rb,
lib/mocha/stubbing_error.rb,
lib/mocha/integration/test_unit/adapter.rb,
lib/mocha/integration/mini_test/adapter.rb

Defined Under Namespace

Modules: API, ClassMethods, Hooks, Integration, ObjectMethods, ParameterMatchers Classes: Configuration, Expectation, ExpectationError, ExpectationErrorFactory, Mock, Sequence, StateMachine, StubbingError

Class Method Summary collapse

Class Method Details

.configure {|configuration| ... } ⇒ Object

Allows setting of configuration options. See Configuration for the available options.

Typically the configuration is set globally in a test_helper.rb or spec_helper.rb file.

Examples:

Setting multiple configuration options

Mocha.configure do |c|
  c.stubbing_method_unnecessarily = :prevent
  c.stubbing_method_on_non_mock_object = :warn
  c.stubbing_method_on_nil = :allow
end

Yield Parameters:

  • configuration (Configuration)

    the configuration for modification

See Also:



19
20
21
# File 'lib/mocha/configuration.rb', line 19

def self.configure
  yield configuration
end