diff --git a/.gitignore b/.gitignore index d984acb6a..2d3526876 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ TODO Gemfile*.lock +doc pkg templates agiledox.txt diff --git a/doc/.nojekyll b/doc/.nojekyll deleted file mode 100644 index e69de29bb..000000000 diff --git a/doc/Mocha.html b/doc/Mocha.html deleted file mode 100644 index 89a4b28c3..000000000 --- a/doc/Mocha.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - Module: Mocha - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Module: Mocha - - - -

- -
- - - - - - - - -
Defined in:
-
lib/mocha/api.rb,
- lib/mocha/mock.rb,
lib/mocha/object.rb,
lib/mocha/sequence.rb,
lib/mocha/expectation.rb,
lib/mocha/configuration.rb,
lib/mocha/state_machine.rb,
lib/mocha/stubbing_error.rb,
lib/mocha/parameter_matchers.rb,
lib/mocha/unexpected_invocation.rb,
lib/mocha/parameter_matchers/not.rb,
lib/mocha/parameter_matchers/base.rb,
lib/mocha/parameter_matchers/is_a.rb,
lib/mocha/parameter_matchers/any_of.rb,
lib/mocha/parameter_matchers/all_of.rb,
lib/mocha/parameter_matchers/equals.rb,
lib/mocha/parameter_matchers/object.rb,
lib/mocha/parameter_matchers/has_key.rb,
lib/mocha/parameter_matchers/kind_of.rb,
lib/mocha/parameter_matchers/includes.rb,
lib/mocha/parameter_matchers/anything.rb,
lib/mocha/parameter_matchers/has_value.rb,
lib/mocha/parameter_matchers/has_entry.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/query_string.rb,
lib/mocha/parameter_matchers/responds_with.rb,
lib/mocha/parameter_matchers/any_parameters.rb,
lib/mocha/parameter_matchers/regexp_matches.rb,
lib/mocha/parameter_matchers/yaml_equivalent.rb
-
- -
-
- -

Defined Under Namespace

-

- - - Modules: API, ClassMethods, ObjectMethods, ParameterMatchers - - - - Classes: Configuration, Expectation, Mock, Sequence, StateMachine, StubbingError, UnexpectedInvocation - - -

- - - - - - - - - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/API.html b/doc/Mocha/API.html deleted file mode 100644 index 7aacbf652..000000000 --- a/doc/Mocha/API.html +++ /dev/null @@ -1,898 +0,0 @@ - - - - - - Module: Mocha::API - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Module: Mocha::API - - - -

- -
- - - - - -
Includes:
-
ParameterMatchers
- - - - - -
Defined in:
-
lib/mocha/api.rb
- -
-
- -

Overview

-
- -

Methods added to Test::Unit::TestCase or equivalent.

- - -
-
-
- - -
- - - - - - - -

- Instance Method Summary - (collapse) -

- - - - - - - - - - - - -

Methods included from ParameterMatchers

-

#Not, #all_of, #any_of, #any_parameters, #anything, #equals, #has_entries, #has_entry, #has_equivalent_query_string, #has_key, #has_value, #includes, #instance_of, #is_a, #kind_of, #optionally, #regexp_matches, #responds_with, #yaml_equivalent

- - -
-

Instance Method Details

- - -
-

- - - - (Mock) mock(name, &block) - - - (Mock) mock(expected_methods_vs_return_values = {}, &block) - - - (Mock) mock(name, expected_methods_vs_return_values = {}, &block) - - - - -

-
- -

Builds a new mock object

- - -
-
-
- -
-

Examples:

- -

-

Using expected_methods_vs_return_values Hash to setup expectations.

-

-
def test_motor_starts_and_stops
-  motor = mock('motor', :start => true, :stop => true)
-  assert motor.start
-  assert motor.stop
-  # an error will be raised unless both Motor#start and Motor#stop have been called
-end
- -

-

Using the optional block to setup expectations & stubbed methods.

-

-
def test_motor_starts_and_stops
-  motor = mock('motor') do
-    expects(:start).with(100.rpm).returns(true)
-    stubs(:stop).returns(true)
-  end
-  assert motor.start(100.rpm)
-  assert motor.stop
-  # an error will only be raised if Motor#start(100.rpm) has not been called
-end
- -
-

Parameters:

-
    - -
  • - - name - - - (String) - - - - — -
    -

    identifies mock object in error messages.

    -
    - -
  • - -
  • - - expected_methods_vs_return_values - - - (Hash) - - - - — -
    -

    expected method name symbols as keys and corresponding return values as -values - these expectations are setup as if Mock#expects were called -multiple times.

    -
    - -
  • - -
- -

Yields:

-
    - -
  • - - - - - - - -
    -

    optional block to be evaluated against the mock object instance, giving an -alternative way to setup expectations.

    -
    - -
  • - -
-

Returns:

-
    - -
  • - - - (Mock) - - - - — -
    -

    a new mock object

    -
    - -
  • - -
- -
- - - - -
-
-
-
-40
-41
-42
-43
-44
-45
-46
-
-
# File 'lib/mocha/api.rb', line 40
-
-def mock(*arguments, &block)
-  name = arguments.shift if arguments.first.is_a?(String)
-  expectations = arguments.shift || {}
-  mock = name ? Mockery.instance.named_mock(name, &block) : Mockery.instance.unnamed_mock(&block)
-  mock.expects(expectations)
-  mock
-end
-
-
- -
-

- - - (Sequence) sequence(name) - - - -

-
- -

Builds a new sequence which can be used to constrain the order in which -expectations can occur.

- -

Specify that an expected invocation must occur within a named Sequence by -using Expectation#in_sequence.

- - -
-
-
- -
-

Examples:

- -

-

Ensure methods on egg are invoked in correct order.

-

-
breakfast = sequence('breakfast')
-
-egg = mock('egg') do
-  expects(:crack).in_sequence(breakfast)
-  expects(:fry).in_sequence(breakfast)
-  expects(:eat).in_sequence(breakfast)
-end
- -
- -

Returns:

-
    - -
  • - - - (Sequence) - - - - — -
    -

    a new sequence

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-128
-129
-130
-
-
# File 'lib/mocha/api.rb', line 128
-
-def sequence(name)
-  Sequence.new(name)
-end
-
-
- -
-

- - - (StateMachine) states(name) - - - -

-
- -

Builds a new state machine which can be used to constrain the order in -which expectations can occur.

- -

Specify the initial state of the state machine by using -StateMachine#starts_as.

- -

Specify that an expected invocation should change the state of the state -machine by using Expectation#then.

- -

Specify that an expected invocation should be constrained to occur within a -particular state by using Expectation#when.

- -

A test can contain multiple state machines.

- - -
-
-
- -
-

Examples:

- -

-

Constrain expected invocations to occur in particular states.

-

-
power = states('power').starts_as('off')
-
-radio = mock('radio') do
-  expects(:switch_on).then(power.is('on'))
-  expects(:select_channel).with('BBC Radio 4').when(power.is('on'))
-  expects(:adjust_volume).with(+5).when(power.is('on'))
-  expects(:select_channel).with('BBC World Service').when(power.is('on'))
-  expects(:adjust_volume).with(-5).when(power.is('on'))
-  expects(:switch_off).then(power.is('off'))
-end
- -
- -

Returns:

-
    - -
  • - - - (StateMachine) - - - - — -
    -

    a new state machine

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-158
-159
-160
-
-
# File 'lib/mocha/api.rb', line 158
-
-def states(name)
-  Mockery.instance.new_state_machine(name)
-end
-
-
- -
-

- - - - (Mock) stub(name, &block) - - - (Mock) stub(stubbed_methods_vs_return_values = {}, &block) - - - (Mock) stub(name, stubbed_methods_vs_return_values = {}, &block) - - - - -

-
- -

Builds a new mock object

- - -
-
-
- -
-

Examples:

- -

-

Using stubbed_methods_vs_return_values Hash to setup stubbed methods.

-

-
def test_motor_starts_and_stops
-  motor = mock('motor', :start => true, :stop => true)
-  assert motor.start
-  assert motor.stop
-  # an error will not be raised even if either Motor#start or Motor#stop has not been called
-end
- -

-

Using the optional block to setup expectations & stubbed methods.

-

-
def test_motor_starts_and_stops
-  motor = mock('motor') do
-    expects(:start).with(100.rpm).returns(true)
-    stubs(:stop).returns(true)
-  end
-  assert motor.start(100.rpm)
-  assert motor.stop
-  # an error will only be raised if Motor#start(100.rpm) has not been called
-end
- -
-

Parameters:

-
    - -
  • - - name - - - (String) - - - - — -
    -

    identifies mock object in error messages.

    -
    - -
  • - -
  • - - stubbed_methods_vs_return_values - - - (Hash) - - - - — -
    -

    stubbed method name symbols as keys and corresponding return values as -values - these stubbed methods are setup as if Mock#stubs were called -multiple times.

    -
    - -
  • - -
- -

Yields:

-
    - -
  • - - - - - - - -
    -

    optional block to be evaluated against the mock object instance, giving an -alternative way to setup stubbed methods.

    -
    - -
  • - -
-

Returns:

-
    - -
  • - - - (Mock) - - - - — -
    -

    a new mock object

    -
    - -
  • - -
- -
- - - - -
-
-
-
-77
-78
-79
-80
-81
-82
-83
-
-
# File 'lib/mocha/api.rb', line 77
-
-def stub(*arguments, &block)
-  name = arguments.shift if arguments.first.is_a?(String)
-  expectations = arguments.shift || {}
-  stub = name ? Mockery.instance.named_mock(name, &block) : Mockery.instance.unnamed_mock(&block)
-  stub.stubs(expectations)
-  stub
-end
-
-
- -
-

- - - - (Mock) stub_everything(name, &block) - - - (Mock) stub_everything(stubbed_methods_vs_return_values = {}, &block) - - - (Mock) stub_everything(name, stubbed_methods_vs_return_values = {}, &block) - - - - -

-
- -

Builds a mock object that accepts calls to any method. By default it will -return nil for any method call.

- - -
-
-
- -
-

Examples:

- -

-

Ignore invocations of irrelevant methods.

-

-
def test_motor_stops
-  motor = stub_everything('motor', :stop => true)
-  assert_nil motor.irrelevant_method_1 # => no error raised
-  assert_nil motor.irrelevant_method_2 # => no error raised
-  assert motor.stop
-end
- -
-

Parameters:

-
    - -
  • - - name - - - (String) - - - - — -
    -

    identifies mock object in error messages.

    -
    - -
  • - -
  • - - stubbed_methods_vs_return_values - - - (Hash) - - - - — -
    -

    stubbed method name symbols as keys and corresponding return values as -values - these stubbed methods are setup as if Mock#stubs were called -multiple times.

    -
    - -
  • - -
- -

Yields:

-
    - -
  • - - - - - - - -
    -

    optional block to be evaluated against the mock object instance, giving an -alternative way to setup stubbed methods.

    -
    - -
  • - -
-

Returns:

-
    - -
  • - - - (Mock) - - - - — -
    -

    a new mock object

    -
    - -
  • - -
- -
- - - - -
-
-
-
-103
-104
-105
-106
-107
-108
-109
-110
-
-
# File 'lib/mocha/api.rb', line 103
-
-def stub_everything(*arguments, &block)
-  name = arguments.shift if arguments.first.is_a?(String)
-  expectations = arguments.shift || {}
-  stub = name ? Mockery.instance.named_mock(name, &block) : Mockery.instance.unnamed_mock(&block)
-  stub.stub_everything
-  stub.stubs(expectations)
-  stub
-end
-
-
- -
- -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ClassMethods.html b/doc/Mocha/ClassMethods.html deleted file mode 100644 index 09f67ca2a..000000000 --- a/doc/Mocha/ClassMethods.html +++ /dev/null @@ -1,246 +0,0 @@ - - - - - - Module: Mocha::ClassMethods - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Module: Mocha::ClassMethods - - - -

- -
- - - - - - - - -
Defined in:
-
lib/mocha/object.rb
- -
-
- -

Overview

-
- -

Methods added to all classes to allow mocking and stubbing on real (i.e. -non-mock) objects.

- - -
-
-
- - -
- - - - - - - -

- Instance Method Summary - (collapse) -

- - - - - - -
-

Instance Method Details

- - -
-

- - - (Mock) any_instance - - - -

-
- -

A mock object which will detect calls to any instance of this class.

- - -
-
-
- -
-

Examples:

- -

-

Return false to invocation of Product#save for any instance of -Product.

-

-
Product.any_instance.stubs(:save).returns(false)
-product_1 = Product.new
-assert_equal false, product_1.save
-product_2 = Product.new
-assert_equal false, product_2.save
- -
- -

Returns:

-
    - -
  • - - - (Mock) - - - - — -
    -

    a mock object which will detect calls to any instance of this class.

    -
    - -
  • - -
-

Raises:

-
    - -
  • - - - (StubbingError) - - - - — -
    -

    if attempting to stub method which is not allowed.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-231
-232
-233
-234
-235
-236
-
-
# File 'lib/mocha/object.rb', line 231
-
-def any_instance
-  if frozen?
-    raise StubbingError.new("can't stub method on frozen object: #{mocha_inspect}.any_instance", caller)
-  end
-  @any_instance ||= AnyInstance.new(self)
-end
-
-
- -
- -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/Configuration.html b/doc/Mocha/Configuration.html deleted file mode 100644 index 335f7b067..000000000 --- a/doc/Mocha/Configuration.html +++ /dev/null @@ -1,471 +0,0 @@ - - - - - - Class: Mocha::Configuration - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::Configuration - - - -

- -
- -
Inherits:
-
- Object - -
    -
  • Object
  • - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/configuration.rb
- -
-
- -

Overview

-
- -

Configuration settings.

- - -
-
-
- - -
-

Constant Summary

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

- Class Method Summary - (collapse) -

- - - - - - -
-

Class Method Details

- - -
-

- - + (Object) allow(action) { ... } - - - -

-
- -

Allow the specified action.

- - -
-
-
-

Parameters:

-
    - -
  • - - action - - - (Symbol) - - - - — -
    -

    one of :stubbing_method_unnecessarily, -:stubbing_method_on_non_mock_object, -:stubbing_non_existent_method, -:stubbing_non_public_method, :stubbing_method_on_nil.

    -
    - -
  • - -
- -

Yields:

-
    - -
  • - - - - - - - -
    -

    optional block during which the configuration change will be changed before -being returned to its original value at the end of the block.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-20
-21
-22
-
-
# File 'lib/mocha/configuration.rb', line 20
-
-def allow(action, &block)
-  change_config action, :allow, &block
-end
-
-
- -
-

- - + (Object) prevent(action) { ... } - - - -

-
- -

Raise a StubbingError if if the specified action is attempted.

- - -
-
-
-

Parameters:

-
    - -
  • - - action - - - (Symbol) - - - - — -
    -

    one of :stubbing_method_unnecessarily, -:stubbing_method_on_non_mock_object, -:stubbing_non_existent_method, -:stubbing_non_public_method, :stubbing_method_on_nil.

    -
    - -
  • - -
- -

Yields:

-
    - -
  • - - - - - - - -
    -

    optional block during which the configuration change will be changed before -being returned to its original value at the end of the block.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-46
-47
-48
-
-
# File 'lib/mocha/configuration.rb', line 46
-
-def prevent(action, &block)
-  change_config action, :prevent, &block
-end
-
-
- -
-

- - + (Object) warn_when(action) { ... } - - - -

-
- -

Warn if the specified action is attempted.

- - -
-
-
-

Parameters:

-
    - -
  • - - action - - - (Symbol) - - - - — -
    -

    one of :stubbing_method_unnecessarily, -:stubbing_method_on_non_mock_object, -:stubbing_non_existent_method, -:stubbing_non_public_method, :stubbing_method_on_nil.

    -
    - -
  • - -
- -

Yields:

-
    - -
  • - - - - - - - -
    -

    optional block during which the configuration change will be changed before -being returned to its original value at the end of the block.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-33
-34
-35
-
-
# File 'lib/mocha/configuration.rb', line 33
-
-def warn_when(action, &block)
-  change_config action, :warn, &block
-end
-
-
- -
- -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/Expectation.html b/doc/Mocha/Expectation.html deleted file mode 100644 index 3d3152b08..000000000 --- a/doc/Mocha/Expectation.html +++ /dev/null @@ -1,2570 +0,0 @@ - - - - - - Class: Mocha::Expectation - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::Expectation - - - -

- -
- -
Inherits:
-
- Object - -
    -
  • Object
  • - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/expectation.rb
- -
-
- -

Overview

-
- -

Methods on expectations returned from Mock#expects, Mock#stubs, -ObjectMethods#expects and ObjectMethods#stubs.

- - -
-
-
- - -
- - - - - - - -

- Instance Method Summary - (collapse) -

- - - - - - -
-

Instance Method Details

- - -
-

- - - (Expectation) at_least(minimum_number_of_times) - - - -

-
- -

Modifies expectation so that the expected method must be called at least a -minimum_number_of_times.

- - -
-
-
- -
-

Examples:

- -

-

Expected method must be called at least twice.

-

-
object = mock()
-object.expects(:expected_method).at_least(2)
-3.times { object.expected_method }
-# => verify succeeds
-
-object = mock()
-object.expects(:expected_method).at_least(2)
-object.expected_method
-# => verify fails
- -
-

Parameters:

-
    - -
  • - - minimum_number_of_times - - - (Integer) - - - - — -
    -

    minimum number of expected invocations.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-132
-133
-134
-135
-
-
# File 'lib/mocha/expectation.rb', line 132
-
-def at_least(minimum_number_of_times)
-  @cardinality = Cardinality.at_least(minimum_number_of_times)
-  self
-end
-
-
- -
-

- - - (Expectation) at_least_once - - - -

-
- -

Modifies expectation so that the expected method must be called at least -once.

- - -
-
-
- -
-

Examples:

- -

-

Expected method must be called at least once.

-

-
object = mock()
-object.expects(:expected_method).at_least_once
-object.expected_method
-# => verify succeeds
-
-object = mock()
-object.expects(:expected_method).at_least_once
-# => verify fails
- -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-150
-151
-152
-153
-
-
# File 'lib/mocha/expectation.rb', line 150
-
-def at_least_once
-  at_least(1)
-  self
-end
-
-
- -
-

- - - (Expectation) at_most(maximum_number_of_times) - - - -

-
- -

Modifies expectation so that the expected method must be called at most a -maximum_number_of_times.

- - -
-
-
- -
-

Examples:

- -

-

Expected method must be called at most twice.

-

-
object = mock()
-object.expects(:expected_method).at_most(2)
-2.times { object.expected_method }
-# => verify succeeds
-
-object = mock()
-object.expects(:expected_method).at_most(2)
-3.times { object.expected_method } # => unexpected invocation
- -
-

Parameters:

-
    - -
  • - - maximum_number_of_times - - - (Integer) - - - - — -
    -

    maximum number of expected invocations.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-169
-170
-171
-172
-
-
# File 'lib/mocha/expectation.rb', line 169
-
-def at_most(maximum_number_of_times)
-  @cardinality = Cardinality.at_most(maximum_number_of_times)
-  self
-end
-
-
- -
-

- - - (Expectation) at_most_once - - - -

-
- -

Modifies expectation so that the expected method must be called at most -once.

- - -
-
-
- -
-

Examples:

- -

-

Expected method must be called at most once.

-

-
object = mock()
-object.expects(:expected_method).at_most_once
-object.expected_method
-# => verify succeeds
-
-object = mock()
-object.expects(:expected_method).at_most_once
-2.times { object.expected_method } # => unexpected invocation
- -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-187
-188
-189
-190
-
-
# File 'lib/mocha/expectation.rb', line 187
-
-def at_most_once()
-  at_most(1)
-  self
-end
-
-
- -
-

- - - (Expectation) in_sequence(*sequences) - - - -

-
- -

Constrains the expectation so that it must be invoked at the current point -in the sequence.

- -

To expect a sequence of invocations, write the expectations in order and -add the in_sequence(sequence) clause to each one.

- -

Expectations in a sequence can have any invocation count.

- -

If an expectation in a sequence is stubbed, rather than expected, it can be -skipped in the sequence.

- -

An expected method can appear in multiple sequences.

- - -
-
-
- -
-

Examples:

- -

-

Ensure methods are invoked in a specified order.

-

-
breakfast = sequence('breakfast')
-
-egg = mock('egg')
-egg.expects(:crack).in_sequence(breakfast)
-egg.expects(:fry).in_sequence(breakfast)
-egg.expects(:eat).in_sequence(breakfast)
- -
-

Parameters:

-
    - -
  • - - sequences - - - (*Array<Sequence>) - - - - — -
    -

    sequences in which expected method should appear.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-494
-495
-496
-497
-
-
# File 'lib/mocha/expectation.rb', line 494
-
-def in_sequence(*sequences)
-  sequences.each { |sequence| add_in_sequence_ordering_constraint(sequence) }
-  self
-end
-
-
- -
-

- - - (Expectation) multiple_yields(*parameter_groups) - - - -

-
- -

Modifies expectation so that when the expected method is called, it yields -multiple times per invocation with the specified parameter_groups.

- - -
-
-
- -
-

Examples:

- -

-

When the expected_method is called, the stub will invoke the block -twice, the first time it passes 'result_1', 'result_2' as the -parameters, and the second time it passes 'result_3' as the parameters.

-

-
object = mock()
-object.expects(:expected_method).multiple_yields(['result_1', 'result_2'], ['result_3'])
-yielded_values = []
-object.expected_method { |*values| yielded_values << values }
-yielded_values # => [['result_1', 'result_2'], ['result_3]]
- -

-

Yield different groups of parameters on different invocations of the -expected method.

-

-
object = mock()
-object.stubs(:expected_method).multiple_yields([1, 2], [3]).then.multiple_yields([4], [5, 6])
-yielded_values_from_first_invocation = []
-yielded_values_from_second_invocation = []
-object.expected_method { |*values| yielded_values_from_first_invocation << values } # first invocation
-object.expected_method { |*values| yielded_values_from_second_invocation << values } # second invocation
-yielded_values_from_first_invocation # => [[1, 2], [3]]
-yielded_values_from_second_invocation # => [[4], [5, 6]]
- -
-

Parameters:

-
    - -
  • - - parameter_groups - - - (*Array<Array>) - - - - — -
    -

    each element of parameter_groups should iself be an Array -representing the parameters to be passed to the block for a single yield.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-279
-280
-281
-282
-
-
# File 'lib/mocha/expectation.rb', line 279
-
-def multiple_yields(*parameter_groups)
-  @yield_parameters.multiple_add(*parameter_groups)
-  self
-end
-
-
- -
-

- - - (Expectation) never - - - -

-
- -

Modifies expectation so that the expected method must never be called.

- - -
-
-
- -
-

Examples:

- -

-

Expected method must never be called.

-

-
object = mock()
-object.expects(:expected_method).never
-object.expected_method # => unexpected invocation
-
-object = mock()
-object.expects(:expected_method).never
-# => verify succeeds
- -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-112
-113
-114
-115
-
-
# File 'lib/mocha/expectation.rb', line 112
-
-def never
-  @cardinality = Cardinality.exactly(0)
-  self
-end
-
-
- -
-

- - - (Expectation) once - - - -

-
- -

Modifies expectation so that the expected method must be called exactly -once.

- -

Note that this is the default behaviour for an expectation, but you may -wish to use it for clarity/emphasis.

- - -
-
-
- -
-

Examples:

- -

-

Expected method must be invoked exactly once.

-

-
object = mock()
-object.expects(:expected_method).once
-object.expected_method
-# => verify succeeds
-
-object = mock()
-object.expects(:expected_method).once
-object.expected_method
-object.expected_method # => unexpected invocation
-
-object = mock()
-object.expects(:expected_method).once
-# => verify fails
- -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-95
-96
-97
-98
-
-
# File 'lib/mocha/expectation.rb', line 95
-
-def once
-  @cardinality = Cardinality.exactly(1)
-  self
-end
-
-
- -
-

- - - - (Expectation) raises - - - (Expectation) raises(exception) - - - (Expectation) raises(exception, message) - - - - -

-
- -

Modifies expectation so that when the expected method is called, it raises -the specified exception with the specified message i.e. -calls Kernel#raise(exception, message).

- - -
-
-
- -
-

Examples:

- -

-

Raise specified exception if expected method is invoked.

-

-
object = stub()
-object.stubs(:expected_method).raises(Exception, 'message')
-object.expected_method # => raises exception of class Exception and with message 'message'
- -

-

Raise custom exception with extra constructor parameters by passing in an -instance of the exception.

-

-
object = stub()
-object.stubs(:expected_method).raises(MyException.new('message', 1, 2, 3))
-object.expected_method # => raises the specified instance of MyException
- -

-

Raise different exceptions on consecutive invocations of the expected -method.

-

-
object = stub()
-object.stubs(:expected_method).raises(Exception1).then.raises(Exception2)
-object.expected_method # => raises exception of class Exception1
-object.expected_method # => raises exception of class Exception2
- -

-

Raise an exception on first invocation of expected method and then return -values on subsequent invocations.

-

-
object = stub()
-object.stubs(:expected_method).raises(Exception).then.returns(2, 3)
-object.expected_method # => raises exception of class Exception1
-object.expected_method # => 2
-object.expected_method # => 3
- -
-

Parameters:

-
    - -
  • - - exception - - - (Class, Exception, String, #exception) - - - (defaults to: RuntimeError) - - - — -
    -

    exception to be raised or message to be passed to RuntimeError.

    -
    - -
  • - -
  • - - message - - - (String) - - - (defaults to: nil) - - - — -
    -

    exception message.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -

See Also:

-
    - -
  • Kernel#raise
  • - -
  • #then
  • - -
- -
- - - - -
-
-
-
-366
-367
-368
-369
-
-
# File 'lib/mocha/expectation.rb', line 366
-
-def raises(exception = RuntimeError, message = nil)
-  @return_values += ReturnValues.new(ExceptionRaiser.new(exception, message))
-  self
-end
-
-
- -
-

- - - - (Expectation) returns(value) - - - (Expectation) returns(*values) - - - - -

-
- -

Modifies expectation so that when the expected method is called, it returns -the specified value.

- - -
-
-
- -
-

Examples:

- -

-

Return the same value on every invocation.

-

-
object = mock()
-object.stubs(:stubbed_method).returns('result')
-object.stubbed_method # => 'result'
-object.stubbed_method # => 'result'
- -

-

Return a different value on consecutive invocations.

-

-
object = mock()
-object.stubs(:stubbed_method).returns(1, 2)
-object.stubbed_method # => 1
-object.stubbed_method # => 2
- -

-

Alternative way to return a different value on consecutive invocations.

-

-
object = mock()
-object.stubs(:expected_method).returns(1, 2).then.returns(3)
-object.expected_method # => 1
-object.expected_method # => 2
-object.expected_method # => 3
- -

-

May be called in conjunction with #raises on the same expectation.

-

-
object = mock()
-object.stubs(:expected_method).returns(1, 2).then.raises(Exception)
-object.expected_method # => 1
-object.expected_method # => 2
-object.expected_method # => raises exception of class Exception1
- -

-

Note that in Ruby a method returning multiple values is exactly equivalent -to a method returning an Array of those values.

-

-
object = mock()
-object.stubs(:expected_method).returns([1, 2])
-x, y = object.expected_method
-x # => 1
-y # => 2
- -
- -

Overloads:

-
    - - -
  • - - (Expectation) returns(value) -
    -
    - - -
    -
    -
    -

    Parameters:

    -
      - -
    • - - value - - - (Object) - - - - — -
      -

      value to return on invocation of expected method.

      -
      - -
    • - -
    - - -
    -
  • - - -
  • - - (Expectation) returns(*values) -
    -
    - - -
    -
    -
    -

    Parameters:

    -
      - -
    • - - values - - - (*Array) - - - - — -
      -

      values to return on consecutive invocations of expected method.

      -
      - -
    • - -
    - - -
    -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-326
-327
-328
-329
-
-
# File 'lib/mocha/expectation.rb', line 326
-
-def returns(*values)
-  @return_values += ReturnValues.build(*values)
-  self
-end
-
-
- -
-

- - - - (Expectation) then - - - (Expectation) then(state_machine.is(state_name)) - - - - -

-
- -

The same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

- - -
-
-
- -
-

Examples:

- -

-

Using #then as syntactic sugar when specifying values to be returned and -exceptions to be raised on consecutive invocations of the expected method.

-

-
object = mock()
-object.stubs(:expected_method).returns(1, 2).then.raises(Exception).then.returns(4)
-object.expected_method # => 1
-object.expected_method # => 2
-object.expected_method # => raises exception of class Exception
-object.expected_method # => 4
- -

-

Using #then to change the state of a state_machine on -the invocation of an expected method.

-

-
power = states('power').starts_as('off')
-
-radio = mock('radio')
-radio.expects(:switch_on).then(power.is('on'))
-radio.expects(:select_channel).with('BBC Radio 4').when(power.is('on'))
-radio.expects(:adjust_volume).with(+5).when(power.is('on'))
-radio.expects(:select_channel).with('BBC World Service').when(power.is('on'))
-radio.expects(:adjust_volume).with(-5).when(power.is('on'))
-radio.expects(:switch_off).then(power.is('off'))
- -
- -

Overloads:

-
    - - -
  • - - (Expectation) then -
    -
    - -

    Used as syntactic sugar to improve readability. It has no effect on state -of the expectation.

    - - -
    -
    -
    - - -
    -
  • - - -
  • - - (Expectation) then(state_machine.is(state_name)) -
    -
    - -

    Used to change the state_machine to the state specified by -state_name when the expected invocation occurs.

    - - -
    -
    -
    -

    Parameters:

    -
      - -
    • - - state_machine.is(state_name) - - - (StateMachine::State) - - - - — -
      -

      provides a mechanism to change the state_machine into the state -specified by state_name when the expected method is invoked.

      -
      - -
    • - -
    - - -

    See Also:

    - - -
    -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-440
-441
-442
-443
-444
-445
-446
-
-
# File 'lib/mocha/expectation.rb', line 440
-
-def then(*parameters)
-  if parameters.length == 1
-    state = parameters.first
-    add_side_effect(ChangeStateSideEffect.new(state))
-  end
-  self
-end
-
-
- -
-

- - - - (Expectation) throw(tag) - - - (Expectation) throw(tag, object) - - - - -

-
- -

Modifies expectation so that when the expected method is called, it throws -the specified tag with the specific return value object -i.e. calls Kernel#throw(tag, object).

- - -
-
-
- -
-

Examples:

- -

-

Throw tag when expected method is invoked.

-

-
object = stub()
-object.stubs(:expected_method).throws(:done)
-object.expected_method # => throws tag :done
- -

-

Throw tag with return value object c.f. Kernel#throw.

-

-
object = stub()
-object.stubs(:expected_method).throws(:done, 'result')
-object.expected_method # => throws tag :done and causes catch block to return 'result'
- -

-

Throw different tags on consecutive invocations of the expected method.

-

-
object = stub()
-object.stubs(:expected_method).throws(:done).then.throws(:continue)
-object.expected_method # => throws :done
-object.expected_method # => throws :continue
- -

-

Throw tag on first invocation of expected method and then return values for -subsequent invocations.

-

-
object = stub()
-object.stubs(:expected_method).throws(:done).then.returns(2, 3)
-object.expected_method # => throws :done
-object.expected_method # => 2
-object.expected_method # => 3
- -
-

Parameters:

-
    - -
  • - - tag - - - (Symbol, String) - - - - — -
    -

    tag to throw to transfer control to the active catch block.

    -
    - -
  • - -
  • - - object - - - (Object) - - - (defaults to: nil) - - - — -
    -

    return value for the catch block.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -

See Also:

-
    - -
  • Kernel#throw
  • - -
  • #then
  • - -
- -
- - - - -
-
-
-
-405
-406
-407
-408
-
-
# File 'lib/mocha/expectation.rb', line 405
-
-def throws(tag, object = nil)
-  @return_values += ReturnValues.new(Thrower.new(tag, object))
-  self
-end
-
-
- -
-

- - - (Expectation) times(range) - - - -

-
- -

Modifies expectation so that the number of calls to the expected method -must be within a specific range.

- - -
-
-
- -
-

Examples:

- -

-

Specifying a specific number of expected invocations.

-

-
object = mock()
-object.expects(:expected_method).times(3)
-3.times { object.expected_method }
-# => verify succeeds
-
-object = mock()
-object.expects(:expected_method).times(3)
-2.times { object.expected_method }
-# => verify fails
- -

-

Specifying a range in the number of expected invocations.

-

-
object = mock()
-object.expects(:expected_method).times(2..4)
-3.times { object.expected_method }
-# => verify succeeds
-
-object = mock()
-object.expects(:expected_method).times(2..4)
-object.expected_method
-# => verify fails
- -
-

Parameters:

-
    - -
  • - - range - - - (Range, Integer) - - - - — -
    -

    specifies the allowable range in the number of expected invocations.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-44
-45
-46
-47
-
-
# File 'lib/mocha/expectation.rb', line 44
-
-def times(range)
-  @cardinality = Cardinality.times(range)
-  self
-end
-
-
- -
-

- - - (Expectation) twice - - - -

-
- -

Modifies expectation so that the expected method must be called exactly -twice.

- - -
-
-
- -
-

Examples:

- -

-

Expected method must be invoked exactly twice.

-

-
object = mock()
-object.expects(:expected_method).twice
-object.expected_method
-object.expected_method
-# => verify succeeds
-
-object = mock()
-object.expects(:expected_method).twice
-object.expected_method
-object.expected_method
-object.expected_method # => unexpected invocation
-
-object = mock()
-object.expects(:expected_method).twice
-object.expected_method
-# => verify fails
- -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-70
-71
-72
-73
-
-
# File 'lib/mocha/expectation.rb', line 70
-
-def twice
-  @cardinality = Cardinality.exactly(2)
-  self
-end
-
-
- -
-

- - - (Expectation) when(state_predicate) - - - -

-
- -

Constrains the expectation to occur only when the state_machine is -in the state specified by state_name.

- - -
-
-
- -
-

Examples:

- -

-

Using #when to only allow invocation of methods when "power" state -machine is in the "on" state.

-

-
power = states('power').starts_as('off')
-
-radio = mock('radio')
-radio.expects(:switch_on).then(power.is('on'))
-radio.expects(:select_channel).with('BBC Radio 4').when(power.is('on'))
-radio.expects(:adjust_volume).with(+5).when(power.is('on'))
-radio.expects(:select_channel).with('BBC World Service').when(power.is('on'))
-radio.expects(:adjust_volume).with(-5).when(power.is('on'))
-radio.expects(:switch_off).then(power.is('off'))
- -
-

Parameters:

-
    - -
  • - - state_machine.is(state_name) - - - (StateMachine::StatePredicate) - - - - — -
    -

    provides a mechanism to determine whether the state_machine is in -the state specified by state_name when the expected method is -invoked.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-467
-468
-469
-470
-
-
# File 'lib/mocha/expectation.rb', line 467
-
-def when(state_predicate)
-  add_ordering_constraint(InStateOrderingConstraint.new(state_predicate))
-  self
-end
-
-
- -
-

- - - (Expectation) with(*expected_parameters) {|actual_parameters| ... } - - - -

-
- -

Modifies expectation so that the expected method must be called with -expected_parameters.

- -

May be used with parameter matchers in ParameterMatchers.

- - -
-
-
- -
-

Examples:

- -

-

Expected method must be called with expected parameters.

-

-
object = mock()
-object.expects(:expected_method).with(:param1, :param2)
-object.expected_method(:param1, :param2)
-# => verify succeeds
-
-object = mock()
-object.expects(:expected_method).with(:param1, :param2)
-object.expected_method(:param3)
-# => verify fails
- -

-

Expected method must be called with a value divisible by 4.

-

-
object = mock()
-object.expects(:expected_method).with() { |value| value % 4 == 0 }
-object.expected_method(16)
-# => verify succeeds
-
-object = mock()
-object.expects(:expected_method).with() { |value| value % 4 == 0 }
-object.expected_method(17)
-# => verify fails
- -
-

Parameters:

-
    - -
  • - - expected_parameters - - - (*Array) - - - - — -
    -

    parameters expected.

    -
    - -
  • - -
- -

Yields:

-
    - -
  • - - - - - - - -
    -

    optional block specifying custom matching.

    -
    - -
  • - -
-

Yield Parameters:

-
    - -
  • - - actual_parameters - - - (*Array) - - - - — -
    -

    parameters with which expected method was invoked.

    -
    - -
  • - -
-

Yield Returns:

-
    - -
  • - - - (Boolean) - - - - — -
    -

    true if actual_parameters are acceptable.

    -
    - -
  • - -
-

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-223
-224
-225
-226
-
-
# File 'lib/mocha/expectation.rb', line 223
-
-def with(*expected_parameters, &matching_block)
-  @parameters_matcher = ParametersMatcher.new(expected_parameters, &matching_block)
-  self
-end
-
-
- -
-

- - - (Expectation) yields(*parameters) - - - -

-
- -

Modifies expectation so that when the expected method is called, it yields -with the specified parameters.

- -

May be called multiple times on the same expectation for consecutive -invocations.

- - -
-
-
- -
-

Examples:

- -

-

Yield parameters when expected method is invoked.

-

-
object = mock()
-object.expects(:expected_method).yields('result')
-yielded_value = nil
-object.expected_method { |value| yielded_value = value }
-yielded_value # => 'result'
- -

-

Yield different parameters on different invocations of the expected method.

-

-
object = mock()
-object.stubs(:expected_method).yields(1).then.yields(2)
-yielded_values_from_first_invocation = []
-yielded_values_from_second_invocation = []
-object.expected_method { |value| yielded_values_from_first_invocation << value } # first invocation
-object.expected_method { |value| yielded_values_from_second_invocation << value } # second invocation
-yielded_values_from_first_invocation # => [1]
-yielded_values_from_second_invocation # => [2]
- -
-

Parameters:

-
    - -
  • - - parameters - - - (*Array) - - - - — -
    -

    parameters to be yielded.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    the same expectation, thereby allowing invocations of other Mocha::Expectation -methods to be chained.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-252
-253
-254
-255
-
-
# File 'lib/mocha/expectation.rb', line 252
-
-def yields(*parameters)
-  @yield_parameters.add(*parameters)
-  self
-end
-
-
- -
- -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/Mock.html b/doc/Mocha/Mock.html deleted file mode 100644 index eddca4a6a..000000000 --- a/doc/Mocha/Mock.html +++ /dev/null @@ -1,830 +0,0 @@ - - - - - - Class: Mocha::Mock - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::Mock - - - -

- -
- -
Inherits:
-
- Object - -
    -
  • Object
  • - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/mock.rb
- -
-
- -

Overview

-
- -

Traditional mock object.

- -

All methods return an Expectation which can be further modified by -methods on Expectation.

- - -
-
-
- - -
- - - - - - - -

- Instance Method Summary - (collapse) -

- - - - -
-

Dynamic Method Handling

-

- This class handles dynamic methods through the method_missing method - -

- -
-

- - - (Object) method_missing(symbol, *arguments, &block) - - - -

- - - - -
-
-
-
-194
-195
-196
-197
-198
-199
-200
-201
-202
-203
-204
-205
-206
-207
-208
-
-
# File 'lib/mocha/mock.rb', line 194
-
-def method_missing(symbol, *arguments, &block)
-  if @responder and not @responder.respond_to?(symbol)
-    raise NoMethodError, "undefined method `#{symbol}' for #{self.mocha_inspect} which responds like #{@responder.mocha_inspect}"
-  end
-  if matching_expectation_allowing_invocation = @expectations.match_allowing_invocation(symbol, *arguments)
-    matching_expectation_allowing_invocation.invoke(&block)
-  else
-    if (matching_expectation = @expectations.match(symbol, *arguments)) || (!matching_expectation && !@everything_stubbed)
-      matching_expectation.invoke(&block) if matching_expectation
-      message = UnexpectedInvocation.new(self, symbol, *arguments).to_s
-      message << @mockery.mocha_inspect
-      raise ExpectationError.new(message, caller)
-    end
-  end
-end
-
-
- -
- - -
-

Instance Method Details

- - -
-

- - - - (Expectation) expects(method_name) - - - (Expectation) expects(expected_methods_vs_return_values) - - - - - Also known as: - __expects__ - - -

-
- -

Adds an expectation that the specified method must be called exactly once -with any parameters.

- - -
-
-
- -
-

Examples:

- -

-

Expected method invoked once so no error raised

-

-
object = mock()
-object.expects(:expected_method)
-object.expected_method
- -

-

Expected method not invoked so error raised

-

-
object = mock()
-object.expects(:expected_method)
-# error raised when test completes, because expected_method not called exactly once
- -

-

Expected method invoked twice so error raised

-

-
object = mock()
-object.expects(:expected_method)
-object.expected_method
-object.expected_method # => error raised when expected method invoked second time
- -

-

Setup multiple expectations using -expected_methods_vs_return_values.

-

-
object = mock()
-object.expects(:expected_method_one => :result_one, :expected_method_two => :result_two)
-
-# is exactly equivalent to
-
-object = mock()
-object.expects(:expected_method_one).returns(:result_one)
-object.expects(:expected_method_two).returns(:result_two)
- -
-

Parameters:

-
    - -
  • - - method_name - - - (Symbol, String) - - - - — -
    -

    name of expected method

    -
    - -
  • - -
  • - - expected_methods_vs_return_values - - - (Hash) - - - - — -
    -

    expected method name symbols as keys and corresponding return values as -values - these expectations are setup as if #expects were called multiple -times.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    last-built expectation which can be further modified by methods on -Expectation.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-
-
# File 'lib/mocha/mock.rb', line 51
-
-def expects(method_name_or_hash, backtrace = nil)
-  iterator = ArgumentIterator.new(method_name_or_hash)
-  iterator.each { |*args|
-    method_name = args.shift
-    ensure_method_not_already_defined(method_name)
-    expectation = Expectation.new(self, method_name, backtrace)
-    expectation.returns(args.shift) if args.length > 0
-    @expectations.add(expectation)
-  }
-end
-
-
- -
-

- - - (Mock) responds_like(responder) - - - - Also known as: - quacks_like - - -

-
- -

Constrains the Mocha::Mock instance so that it can only expect or stub methods -to which responder responds. The constraint is only applied at -method invocation time.

- -

A NoMethodError will be raised if the responder does not -#respond_to? a method invocation (even if the method has been -expected or stubbed).

- -

The Mocha::Mock instance will delegate its #respond_to? method to the -responder.

- - -
-
-
- -
-

Examples:

- -

-

Normal mocking

-

-
sheep = mock('sheep')
-sheep.expects(:chew)
-sheep.expects(:foo)
-sheep.respond_to?(:chew) # => true
-sheep.respond_to?(:foo) # => true
-sheep.chew
-sheep.foo
-# no error raised
- -

-

Using #responds_like with an instance method

-

-
class Sheep
-  def chew(grass); end
-end
-
-sheep = mock('sheep')
-sheep.responds_like(Sheep.new)
-sheep.expects(:chew)
-sheep.expects(:foo)
-sheep.respond_to?(:chew) # => true
-sheep.respond_to?(:foo) # => false
-sheep.chew
-sheep.foo # => raises NoMethodError exception
- -

-

Using #responds_like with a class method

-

-
class Sheep
-  def self.number_of_legs; end
-end
-
-sheep_class = mock('sheep_class')
-sheep_class.responds_like(Sheep)
-sheep_class.stubs(:number_of_legs).returns(4)
-sheep_class.expects(:foo)
-sheep_class.respond_to?(:number_of_legs) # => true
-sheep_class.respond_to?(:foo) # => false
-assert_equal 4, sheep_class.number_of_legs
-sheep_class.foo # => raises NoMethodError exception
- -
-

Parameters:

-
    - -
  • - - responder - - - (Object, #respond_to?) - - - - — -
    -

    an object used to determine whether Mocha::Mock instance should -#respond_to? to an invocation.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Mock) - - - - — -
    -

    the same Mocha::Mock instance, thereby allowing invocations of other Mocha::Mock -methods to be chained.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-159
-160
-161
-162
-
-
# File 'lib/mocha/mock.rb', line 159
-
-def responds_like(responder)
-  @responder = responder
-  self
-end
-
-
- -
-

- - - - (Expectation) stubs(method_name) - - - (Expectation) stubs(stubbed_methods_vs_return_values) - - - - - Also known as: - __stubs__ - - -

-
- -

Adds an expectation that the specified method may be called any number of -times with any parameters.

- - -
-
-
- -
-

Examples:

- -

-

No error raised however many times stubbed method is invoked

-

-
object = mock()
-object.stubs(:stubbed_method)
-object.stubbed_method
-object.stubbed_method
-# no error raised
- -

-

Setup multiple expectations using -stubbed_methods_vs_return_values.

-

-
object = mock()
-object.stubs(:stubbed_method_one => :result_one, :stubbed_method_two => :result_two)
-
-# is exactly equivalent to
-
-object = mock()
-object.stubs(:stubbed_method_one).returns(:result_one)
-object.stubs(:stubbed_method_two).returns(:result_two)
- -
-

Parameters:

-
    - -
  • - - method_name - - - (Symbol, String) - - - - — -
    -

    name of stubbed method

    -
    - -
  • - -
  • - - stubbed_methods_vs_return_values - - - (Hash) - - - - — -
    -

    stubbed method name symbols as keys and corresponding return values as -values - these stubbed methods are setup as if #stubs were called -multiple times.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    last-built expectation which can be further modified by methods on -Expectation.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-
-
# File 'lib/mocha/mock.rb', line 87
-
-def stubs(method_name_or_hash, backtrace = nil)
-  iterator = ArgumentIterator.new(method_name_or_hash)
-  iterator.each { |*args|
-    method_name = args.shift
-    ensure_method_not_already_defined(method_name)
-    expectation = Expectation.new(self, method_name, backtrace)
-    expectation.at_least(0)
-    expectation.returns(args.shift) if args.length > 0
-    @expectations.add(expectation)
-  }
-end
-
-
- -
-

- - - (Object) unstub(method_name) - - - -

-
- -

Removes the specified stubbed method (added by calls to #expects or -#stubs) and all expectations associated with it.

- - -
-
-
- -
-

Examples:

- -

-

Invoking an unstubbed method causes error to be raised

-

-
object = mock('mock') do
-object.stubs(:stubbed_method).returns(:result_one)
-object.stubbed_method # => :result_one
-object.unstub(:stubbed_method)
-object.stubbed_method # => unexpected invocation: #<Mock:mock>.stubbed_method()
- -
-

Parameters:

-
    - -
  • - - method_name - - - (Symbol) - - - - — -
    -

    name of method to unstub.

    -
    - -
  • - -
- - -
- - - - -
-
-
-
-109
-110
-111
-
-
# File 'lib/mocha/mock.rb', line 109
-
-def unstub(method_name)
-  @expectations.remove_all_matching_method(method_name)
-end
-
-
- -
- -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ObjectMethods.html b/doc/Mocha/ObjectMethods.html deleted file mode 100644 index 39db9e231..000000000 --- a/doc/Mocha/ObjectMethods.html +++ /dev/null @@ -1,668 +0,0 @@ - - - - - - Module: Mocha::ObjectMethods - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Module: Mocha::ObjectMethods - - - -

- -
- - - - - - - - -
Defined in:
-
lib/mocha/object.rb,
- lib/mocha/parameter_matchers/object.rb
-
- -
-
- -

Overview

-
- -

Methods added to all objects to allow mocking and stubbing on real (i.e. -non-mock) objects.

- -

Both #expects and #stubs return an Expectation which can be further -modified by methods on Expectation.

- - -
-
-
- - -
- - - - - - - -

- Instance Method Summary - (collapse) -

- - - - - - -
-

Instance Method Details

- - -
-

- - - - (Expectation) expects(method_name) - - - (Expectation) expects(expected_methods_vs_return_values) - - - - -

-
- -

Adds an expectation that the specified method must be called exactly once -with any parameters.

- -

The original implementation of the method is replaced during the test and -then restored at the end of the test.

- - -
-
-
- -
-

Examples:

- -

-

Setting up an expectation on a non-mock object.

-

-
product = Product.new
-product.expects(:save).returns(true)
-assert_equal true, product.save
- -

-

Setting up multiple expectations on a non-mock object.

-

-
product = Product.new
-product.expects(:valid? => true, :save => true)
-
-# exactly equivalent to
-
-product = Product.new
-product.expects(:valid?).returns(true)
-product.expects(:save).returns(true)
- -
-

Parameters:

-
    - -
  • - - method_name - - - (Symbol, String) - - - - — -
    -

    name of expected method

    -
    - -
  • - -
  • - - expected_methods_vs_return_values - - - (Hash) - - - - — -
    -

    expected method name symbols as keys and corresponding return values as -values - these expectations are setup as if #expects were called multiple -times.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    last-built expectation which can be further modified by methods on -Expectation.

    -
    - -
  • - -
-

Raises:

-
    - -
  • - - - (StubbingError) - - - - — -
    -

    if attempting to stub method which is not allowed.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-
-
# File 'lib/mocha/object.rb', line 66
-
-def expects(expected_methods_vs_return_values)
-  if expected_methods_vs_return_values.to_s =~ /the[^a-z]*spanish[^a-z]*inquisition/i
-    raise Mocha::ExpectationError.new('NOBODY EXPECTS THE SPANISH INQUISITION!')
-  end
-  if frozen?
-    raise StubbingError.new("can't stub method on frozen object: #{mocha_inspect}", caller)
-  end
-  expectation = nil
-  mockery = Mocha::Mockery.instance
-  iterator = ArgumentIterator.new(expected_methods_vs_return_values)
-  iterator.each { |*args|
-    method_name = args.shift
-    mockery.on_stubbing(self, method_name)
-    method = stubba_method.new(stubba_object, method_name)
-    mockery.stubba.stub(method)
-    expectation = mocha.expects(method_name, caller)
-    expectation.returns(args.shift) if args.length > 0
-  }
-  expectation
-end
-
-
- -
-

- - - - (Expectation) stubs(method_name) - - - (Expectation) stubs(stubbed_methods_vs_return_values) - - - - -

-
- -

Adds an expectation that the specified method may be called any number of -times with any parameters.

- - -
-
-
- -
-

Examples:

- -

-

Setting up a stubbed methods on a non-mock object.

-

-
product = Product.new
-product.stubs(:save).returns(true)
-assert_equal true, product.save
- -

-

Setting up multiple stubbed methods on a non-mock object.

-

-
product = Product.new
-product.stubs(:valid? => true, :save => true)
-
-# exactly equivalent to
-
-product = Product.new
-product.stubs(:valid?).returns(true)
-product.stubs(:save).returns(true)
- -
-

Parameters:

-
    - -
  • - - method_name - - - (Symbol, String) - - - - — -
    -

    name of stubbed method

    -
    - -
  • - -
  • - - stubbed_methods_vs_return_values - - - (Hash) - - - - — -
    -

    stubbed method name symbols as keys and corresponding return values as -values - these stubbed methods are setup as if #stubs were called -multiple times.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Expectation) - - - - — -
    -

    last-built expectation which can be further modified by methods on -Expectation.

    -
    - -
  • - -
-

Raises:

-
    - -
  • - - - (StubbingError) - - - - — -
    -

    if attempting to stub method which is not allowed.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-
-
# File 'lib/mocha/object.rb', line 113
-
-def stubs(stubbed_methods_vs_return_values)
-  if frozen?
-    raise StubbingError.new("can't stub method on frozen object: #{mocha_inspect}", caller)
-  end
-  expectation = nil
-  mockery = Mocha::Mockery.instance
-  iterator = ArgumentIterator.new(stubbed_methods_vs_return_values)
-  iterator.each { |*args|
-    method_name = args.shift
-    mockery.on_stubbing(self, method_name)
-    method = stubba_method.new(stubba_object, method_name)
-    mockery.stubba.stub(method)
-    expectation = mocha.stubs(method_name, caller)
-    expectation.returns(args.shift) if args.length > 0
-  }
-  expectation
-end
-
-
- -
-

- - - (Object) unstub(*method_names) - - - -

-
- -

Removes the specified stubbed methods (added by calls to #expects or -#stubs) and all expectations associated with them.

- -

Restores the original behaviour of the methods before they were stubbed.

- -

WARNING: If you #unstub a method which still has unsatisfied -expectations, you may be removing the only way those expectations can be -satisfied. Use #unstub with care.

- - -
-
-
- -
-

Examples:

- -

-

Stubbing and unstubbing a method on a real (non-mock) object.

-

-
multiplier = Multiplier.new
-multiplier.double(2) # => 4
-multiplier.stubs(:double).raises # new behaviour defined
-multiplier.double(2) # => raises exception
-multiplier.unstub(:double) # original behaviour restored
-multiplier.double(2) # => 4
- -

-

Unstubbing multiple methods on a real (non-mock) object.

-

-
multiplier.unstub(:double, :triple)
-
-# exactly equivalent to
-
-multiplier.unstub(:double)
-multiplier.unstub(:triple)
- -
-

Parameters:

-
    - -
  • - - method_names - - - (Array<Symbol>) - - - - — -
    -

    names of methods to unstub.

    -
    - -
  • - -
- - -
- - - - -
-
-
-
-154
-155
-156
-157
-158
-159
-160
-
-
# File 'lib/mocha/object.rb', line 154
-
-def unstub(*method_names)
-  mockery = Mocha::Mockery.instance
-  method_names.each do |method_name|
-    method = stubba_method.new(stubba_object, method_name)
-    mockery.stubba.unstub(method)
-  end
-end
-
-
- -
- -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers.html b/doc/Mocha/ParameterMatchers.html deleted file mode 100644 index f0ded1548..000000000 --- a/doc/Mocha/ParameterMatchers.html +++ /dev/null @@ -1,2715 +0,0 @@ - - - - - - Module: Mocha::ParameterMatchers - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Module: Mocha::ParameterMatchers - - - -

- -
- - - - - - - -
Included in:
-
API
- - - -
Defined in:
-
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/any_of.rb,
lib/mocha/parameter_matchers/all_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/includes.rb,
lib/mocha/parameter_matchers/anything.rb,
lib/mocha/parameter_matchers/has_value.rb,
lib/mocha/parameter_matchers/has_entry.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/query_string.rb,
lib/mocha/parameter_matchers/responds_with.rb,
lib/mocha/parameter_matchers/any_parameters.rb,
lib/mocha/parameter_matchers/regexp_matches.rb,
lib/mocha/parameter_matchers/yaml_equivalent.rb
-
- -
-
- -

Overview

-
- -

Used as parameters for Expectation#with to restrict the parameter values -which will match the expectation. Can be nested.

- - -
-
-
- - -

Defined Under Namespace

-

- - - - - Classes: AllOf, AnyOf, AnyParameters, Anything, Base, Equals, HasEntries, HasEntry, HasKey, HasValue, Includes, InstanceOf, IsA, KindOf, Not, Optionally, QueryStringMatches, RegexpMatches, RespondsWith, YamlEquivalent - - -

- - - - - - - - -

- Instance Method Summary - (collapse) -

- - - - - - -
-

Instance Method Details

- - -
-

- - - (AllOf) all_of(*matchers) - - - -

-
- -

Matches if all matchers match.

- - -
-
-
- -
-

Examples:

- -

-

All parameter matchers match.

-

-
object = mock()
-object.expects(:method_1).with(all_of(includes(1), includes(3)))
-object.method_1([1, 3])
-# no error raised
- -

-

One of the parameter matchers does not match.

-

-
object = mock()
-object.expects(:method_1).with(all_of(includes(1), includes(3)))
-object.method_1([1, 2])
-# error raised, because method_1 was not called with object including 1 and 3
- -
-

Parameters:

-
    - -
  • - - parameter_matchers - - - (*Array<Base>) - - - - — -
    -

    parameter matchers.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (AllOf) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-25
-26
-27
-
-
# File 'lib/mocha/parameter_matchers/all_of.rb', line 25
-
-def all_of(*matchers)
-  AllOf.new(*matchers)
-end
-
-
- -
-

- - - (AnyOf) any_of(*matchers) - - - -

-
- -

Matches if any matchers match.

- - -
-
-
- -
-

Examples:

- -

-

One parameter matcher matches.

-

-
object = mock()
-object.expects(:method_1).with(any_of(1, 3))
-object.method_1(1)
-# no error raised
- -

-

The other parameter matcher matches.

-

-
object = mock()
-object.expects(:method_1).with(any_of(1, 3))
-object.method_1(3)
-# no error raised
- -

-

Neither parameter matcher matches.

-

-
object = mock()
-object.expects(:method_1).with(any_of(1, 3))
-object.method_1(2)
-# error raised, because method_1 was not called with 1 or 3
- -
-

Parameters:

-
    - -
  • - - parameter_matchers - - - (*Array<Base>) - - - - — -
    -

    parameter matchers.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (AnyOf) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-31
-32
-33
-
-
# File 'lib/mocha/parameter_matchers/any_of.rb', line 31
-
-def any_of(*matchers)
-  AnyOf.new(*matchers)
-end
-
-
- -
-

- - - (AnyParameters) any_parameters - - - -

-
- -

Matches any parameters. This is used as the default for a newly built -expectation.

- - -
-
-
- -
-

Examples:

- -

-

Any parameters will match.

-

-
object = mock()
-object.expects(:method_1).with(any_parameters)
-object.method_1(1, 2, 3, 4)
-# no error raised
-
-object = mock()
-object.expects(:method_1).with(any_parameters)
-object.method_1(5, 6, 7, 8, 9, 0)
-# no error raised
- -
- -

Returns:

-
    - -
  • - - - (AnyParameters) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-23
-24
-25
-
-
# File 'lib/mocha/parameter_matchers/any_parameters.rb', line 23
-
-def any_parameters
-  AnyParameters.new
-end
-
-
- -
-

- - - (Anything) anything - - - -

-
- -

Matches any object.

- - -
-
-
- -
-

Examples:

- -

-

Any object will match.

-

-
object = mock()
-object.expects(:method_1).with(anything)
-object.method_1('foo')
-object.method_1(789)
-object.method_1(:bar)
-# no error raised
- -
- -

Returns:

-
    - -
  • - - - (Anything) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-20
-21
-22
-
-
# File 'lib/mocha/parameter_matchers/anything.rb', line 20
-
-def anything
-  Anything.new
-end
-
-
- -
-

- - - (Equals) equals(value) - - - -

-
- -

Matches any Object equalling value.

- - -
-
-
- -
-

Examples:

- -

-

Actual parameter equals expected parameter.

-

-
object = mock()
-object.expects(:method_1).with(equals(2))
-object.method_1(2)
-# no error raised
- -

-

Actual parameter does not equal expected parameter.

-

-
object = mock()
-object.expects(:method_1).with(equals(2))
-object.method_1(3)
-# error raised, because method_1 was not called with an +Object+ that equals 3
- -
-

Parameters:

-
    - -
  • - - value - - - (Object) - - - - — -
    -

    expected value.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Equals) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-26
-27
-28
-
-
# File 'lib/mocha/parameter_matchers/equals.rb', line 26
-
-def equals(value)
-  Equals.new(value)
-end
-
-
- -
-

- - - (HasEntries) has_entries(entries) - - - -

-
- -

Matches Hash containing all entries.

- - -
-
-
- -
-

Examples:

- -

-

Actual parameter contains all expected entries.

-

-
object = mock()
-object.expects(:method_1).with(has_entries('key_1' => 1, 'key_2' => 2))
-object.method_1('key_1' => 1, 'key_2' => 2, 'key_3' => 3)
-# no error raised
- -

-

Actual parameter does not contain all expected entries.

-

-
object = mock()
-object.expects(:method_1).with(has_entries('key_1' => 1, 'key_2' => 2))
-object.method_1('key_1' => 1, 'key_2' => 99)
-# error raised, because method_1 was not called with Hash containing entries: 'key_1' => 1, 'key_2' => 2
- -
-

Parameters:

-
    - -
  • - - entries - - - (Hash) - - - - — -
    -

    expected Hash entries.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (HasEntries) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-27
-28
-29
-
-
# File 'lib/mocha/parameter_matchers/has_entries.rb', line 27
-
-def has_entries(entries)
-  HasEntries.new(entries)
-end
-
-
- -
-

- - - - (HasEntry) has_entry(key, value) - - - (HasEntry) has_entry(single_entry_hash) - - - - -

-
- -

Matches Hash containing entry with key and -value.

- - -
-
-
- -
-

Examples:

- -

-

Actual parameter contains expected entry supplied as key and value.

-

-
object = mock()
-object.expects(:method_1).with(has_entry('key_1', 1))
-object.method_1('key_1' => 1, 'key_2' => 2)
-# no error raised
- -

-

Actual parameter contains expected entry supplied as Hash entry.

-

-
object = mock()
-object.expects(:method_1).with(has_entry('key_1' => 1))
-object.method_1('key_1' => 1, 'key_2' => 2)
-# no error raised
- -

-

Actual parameter does not contain expected entry supplied as key and value.

-

-
object = mock()
-object.expects(:method_1).with(has_entry('key_1', 1))
-object.method_1('key_1' => 2, 'key_2' => 1)
-# error raised, because method_1 was not called with Hash containing entry: 'key_1' => 1
- -

-

Actual parameter does not contain expected entry supplied as Hash -entry.

-

-
-object = mock()
-object.expects(:method_1).with(has_entry('key_1' => 1))
-object.method_1('key_1' => 2, 'key_2' => 1)
-# error raised, because method_1 was not called with Hash containing entry: 'key_1' => 1
- -
- -

Overloads:

-
    - - -
  • - - (HasEntry) has_entry(key, value) -
    -
    - - -
    -
    -
    -

    Parameters:

    -
      - -
    • - - key - - - (Object) - - - - — -
      -

      key for entry.

      -
      - -
    • - -
    • - - value - - - (Object) - - - - — -
      -

      value for entry.

      -
      - -
    • - -
    - - -
    -
  • - - -
  • - - (HasEntry) has_entry(single_entry_hash) -
    -
    - - -
    -
    -
    -

    Parameters:

    -
      - -
    • - - single_entry_hash - - - (Hash) - - - - — -
      -

      Hash with single entry.

      -
      - -
    • - -
    - -

    Raises:

    -
      - -
    • - - - (ArgumentError) - - - - — -
      -

      if single_entry_hash does not contain exactly one entry.

      -
      - -
    • - -
    - -
    -
  • - -
- -

Returns:

-
    - -
  • - - - (HasEntry) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-
-
# File 'lib/mocha/parameter_matchers/has_entry.rb', line 44
-
-def has_entry(*options)
-  key, value = options.shift, options.shift
-  if key.is_a?(Hash)
-    case key.length
-    when 0
-      raise ArgumentError.new("Argument has no entries.")
-    when 1
-      key, value = key.to_a.flatten
-    else
-      raise ArgumentError.new("Argument has multiple entries. Use Mocha::ParameterMatchers#has_entries instead.")
-    end
-  end
-  HasEntry.new(key, value)
-end
-
-
- -
-

- - - (QueryStringMatches) has_equivalent_query_string(uri) - - - -

-
- -

Matches a URI without regard to the ordering of parameters in the query -string.

- - -
-
-
- -
-

Examples:

- -

-

Actual URI has equivalent query string.

-

-
object = mock()
-object.expects(:method_1).with(has_equivalent_query_string('http://example.com/foo?a=1&b=2))
-object.method_1('http://example.com/foo?b=2&a=1')
-# no error raised
- -

-

Actual URI does not have equivalent query string.

-

-
object = mock()
-object.expects(:method_1).with(has_equivalent_query_string('http://example.com/foo?a=1&b=2))
-object.method_1('http://example.com/foo?a=1&b=3')
-# error raised, because the query parameters were different
- -
-

Parameters:

-
    - -
  • - - uri - - - (String) - - - - — -
    -

    URI to match.

    -
    - -
  • - -
- -

Returns:

- - -

See Also:

- - -
- - - - -
-
-
-
-25
-26
-27
-
-
# File 'lib/mocha/parameter_matchers/query_string.rb', line 25
-
-def has_equivalent_query_string(uri)
-  QueryStringMatches.new(uri)
-end
-
-
- -
-

- - - (HasKey) has_key(key) - - - -

-
- -

Matches Hash containing key.

- - -
-
-
- -
-

Examples:

- -

-

Actual parameter contains entry with expected key.

-

-
object = mock()
-object.expects(:method_1).with(has_key('key_1'))
-object.method_1('key_1' => 1, 'key_2' => 2)
-# no error raised
- -

-

Actual parameter does not contain entry with expected key.

-

-
object = mock()
-object.expects(:method_1).with(has_key('key_1'))
-object.method_1('key_2' => 2)
-# error raised, because method_1 was not called with Hash containing key: 'key_1'
- -
-

Parameters:

-
    - -
  • - - key - - - (Object) - - - - — -
    -

    expected key.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (HasKey) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-25
-26
-27
-
-
# File 'lib/mocha/parameter_matchers/has_key.rb', line 25
-
-def has_key(key)
-  HasKey.new(key)
-end
-
-
- -
-

- - - (HasValue) has_value(value) - - - -

-
- -

Matches Hash containing value.

- - -
-
-
- -
-

Examples:

- -

-

Actual parameter contains entry with expected value.

-

-
object = mock()
-object.expects(:method_1).with(has_value(1))
-object.method_1('key_1' => 1, 'key_2' => 2)
-# no error raised
- -

-

Actual parameter does not contain entry with expected value.

-

-
object = mock()
-object.expects(:method_1).with(has_value(1))
-object.method_1('key_2' => 2)
-# error raised, because method_1 was not called with Hash containing value: 1
- -
-

Parameters:

-
    - -
  • - - value - - - (Object) - - - - — -
    -

    expected value.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (HasValue) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-25
-26
-27
-
-
# File 'lib/mocha/parameter_matchers/has_value.rb', line 25
-
-def has_value(value)
-  HasValue.new(value)
-end
-
-
- -
-

- - - (Includes) includes(item) - - - -

-
- -

Matches any object that responds with true to include?(item).

- - -
-
-
- -
-

Examples:

- -

-

Actual parameter includes item.

-

-
object = mock()
-object.expects(:method_1).with(includes('foo'))
-object.method_1(['foo', 'bar'])
-# no error raised
- -

-

Actual parameter does not include item.

-

-
object.method_1(['baz'])
-# error raised, because ['baz'] does not include 'foo'.
- -
-

Parameters:

-
    - -
  • - - item - - - (Object) - - - - — -
    -

    expected item.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Includes) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-23
-24
-25
-
-
# File 'lib/mocha/parameter_matchers/includes.rb', line 23
-
-def includes(item)
-  Includes.new(item)
-end
-
-
- -
-

- - - (InstanceOf) instance_of(klass) - - - -

-
- -

Matches any object that is an instance of klass

- - -
-
-
- -
-

Examples:

- -

-

Actual parameter is an instance of String.

-

-
object = mock()
-object.expects(:method_1).with(instance_of(String))
-object.method_1('string')
-# no error raised
- -

-

Actual parameter is not an instance of String.

-

-
object = mock()
-object.expects(:method_1).with(instance_of(String))
-object.method_1(99)
-# error raised, because method_1 was not called with an instance of String
- -
-

Parameters:

-
    - -
  • - - klass - - - (Class) - - - - — -
    -

    expected class.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (InstanceOf) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-26
-27
-28
-
-
# File 'lib/mocha/parameter_matchers/instance_of.rb', line 26
-
-def instance_of(klass)
-  InstanceOf.new(klass)
-end
-
-
- -
-

- - - (IsA) is_a(klass) - - - -

-
- -

Matches any object that is a klass.

- - -
-
-
- -
-

Examples:

- -

-

Actual parameter is a Integer.

-

-
object = mock()
-object.expects(:method_1).with(is_a(Integer))
-object.method_1(99)
-# no error raised
- -

-

Actual parameter is not a Integer.

-

-
object = mock()
-object.expects(:method_1).with(is_a(Integer))
-object.method_1('string')
-# error raised, because method_1 was not called with an Integer
- -
-

Parameters:

-
    - -
  • - - klass - - - (Class) - - - - — -
    -

    expected class.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (IsA) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-26
-27
-28
-
-
# File 'lib/mocha/parameter_matchers/is_a.rb', line 26
-
-def is_a(klass)
-  IsA.new(klass)
-end
-
-
- -
-

- - - (KindOf) kind_of(klass) - - - -

-
- -

Matches any Object that is a kind of klass.

- - -
-
-
- -
-

Examples:

- -

-

Actual parameter is a kind of Integer.

-

-
object = mock()
-object.expects(:method_1).with(kind_of(Integer))
-object.method_1(99)
-# no error raised
- -

-

Actual parameter is not a kind of Integer.

-

-
object = mock()
-object.expects(:method_1).with(kind_of(Integer))
-object.method_1('string')
-# error raised, because method_1 was not called with a kind of Integer
- -
-

Parameters:

-
    - -
  • - - klass - - - (Class) - - - - — -
    -

    expected class.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (KindOf) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-26
-27
-28
-
-
# File 'lib/mocha/parameter_matchers/kind_of.rb', line 26
-
-def kind_of(klass)
-  KindOf.new(klass)
-end
-
-
- -
-

- - - (Not) Not(matcher) - - - -

-
- -

Matches if matcher does not match.

- - -
-
-
- -
-

Examples:

- -

-

Actual parameter does not include the value 1.

-

-
object = mock()
-object.expects(:method_1).with(Not(includes(1)))
-object.method_1([0, 2, 3])
-# no error raised
- -

-

Actual parameter does include the value 1.

-

-
object = mock()
-object.expects(:method_1).with(Not(includes(1)))
-object.method_1([0, 1, 2, 3])
-# error raised, because method_1 was not called with object not including 1
- -
-

Parameters:

-
    - -
  • - - matcher - - - (Base) - - - - — -
    -

    matcher whose logic to invert.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Not) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-25
-26
-27
-
-
# File 'lib/mocha/parameter_matchers/not.rb', line 25
-
-def Not(matcher)
-  Not.new(matcher)
-end
-
-
- -
-

- - - (Optionally) optionally(*matchers) - - - -

-
- -

Matches optional parameters if available.

- - -
-
-
- -
-

Examples:

- -

-

Only the two required parameters are supplied and they both match their -expected value.

-

-
object = mock()
-object.expects(:method_1).with(1, 2, optionally(3, 4))
-object.method_1(1, 2)
-# no error raised
- -

-

Both required parameters and one of the optional parameters are supplied -and they all match their expected value.

-

-
object = mock()
-object.expects(:method_1).with(1, 2, optionally(3, 4))
-object.method_1(1, 2, 3)
-# no error raised
- -

-

Both required parameters and both of the optional parameters are supplied -and they all match their expected value.

-

-
object = mock()
-object.expects(:method_1).with(1, 2, optionally(3, 4))
-object.method_1(1, 2, 3, 4)
-# no error raised
- -

-

One of the actual optional parameters does not match the expected value.

-

-
object = mock()
-object.expects(:method_1).with(1, 2, optionally(3, 4))
-object.method_1(1, 2, 3, 5)
-# error raised, because optional parameters did not match
- -
-

Parameters:

-
    - -
  • - - matchers - - - (*Array<Base>) - - - - — -
    -

    matchers for optional parameters.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (Optionally) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-35
-36
-37
-
-
# File 'lib/mocha/parameter_matchers/optionally.rb', line 35
-
-def optionally(*matchers)
-  Optionally.new(*matchers)
-end
-
-
- -
-

- - - (RegexpMatches) regexp_matches(regexp) - - - -

-
- -

Matches any object that matches regexp.

- - -
-
-
- -
-

Examples:

- -

-

Actual parameter is matched by specified regular expression.

-

-
object = mock()
-object.expects(:method_1).with(regexp_matches(/e/))
-object.method_1('hello')
-# no error raised
- -

-

Actual parameter is not matched by specified regular expression.

-

-
object = mock()
-object.expects(:method_1).with(regexp_matches(/a/))
-object.method_1('hello')
-# error raised, because method_1 was not called with a parameter that matched the
-# regular expression
- -
-

Parameters:

-
    - -
  • - - regexp - - - (Regexp) - - - - — -
    -

    regular expression to match.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (RegexpMatches) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-26
-27
-28
-
-
# File 'lib/mocha/parameter_matchers/regexp_matches.rb', line 26
-
-def regexp_matches(regexp)
-  RegexpMatches.new(regexp)
-end
-
-
- -
-

- - - (RespondsWith) responds_with(message, result) - - - -

-
- -

Matches any object that responds to message with result. -To put it another way, it tests the quack, not the duck.

- - -
-
-
- -
-

Examples:

- -

-

Actual parameter responds with "FOO" when :upcase is invoked.

-

-
object = mock()
-object.expects(:method_1).with(responds_with(:upcase, "FOO"))
-object.method_1("foo")
-# no error raised, because "foo".upcase == "FOO"
- -

-

Actual parameter does not respond with "FOO" when :upcase is invoked.

-

-
object = mock()
-object.expects(:method_1).with(responds_with(:upcase, "BAR"))
-object.method_1("foo")
-# error raised, because "foo".upcase != "BAR"
- -
-

Parameters:

-
    - -
  • - - message - - - (Symbol) - - - - — -
    -

    method to invoke.

    -
    - -
  • - -
  • - - result - - - (Object) - - - - — -
    -

    expected result of sending message.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (RespondsWith) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-27
-28
-29
-
-
# File 'lib/mocha/parameter_matchers/responds_with.rb', line 27
-
-def responds_with(message, result)
-  RespondsWith.new(message, result)
-end
-
-
- -
-

- - - (YamlEquivalent) yaml_equivalent(object) - - - -

-
- -

Matches any YAML that represents the specified object

- - -
-
-
- -
-

Examples:

- -

-

Actual parameter is YAML equivalent of specified object.

-

-
object = mock()
-object.expects(:method_1).with(yaml_equivalent(1, 2, 3))
-object.method_1("--- \n- 1\n- 2\n- 3\n")
-# no error raised
- -

-

Actual parameter is not YAML equivalent of specified object.

-

-
object = mock()
-object.expects(:method_1).with(yaml_equivalent(1, 2, 3))
-object.method_1("--- \n- 1\n- 2\n")
-# error raised, because method_1 was not called with YAML representing the specified Array
- -
-

Parameters:

-
    - -
  • - - object - - - (Object) - - - - — -
    -

    object whose YAML to compare.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (YamlEquivalent) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-26
-27
-28
-
-
# File 'lib/mocha/parameter_matchers/yaml_equivalent.rb', line 26
-
-def yaml_equivalent(object)
-  YamlEquivalent.new(object)
-end
-
-
- -
- -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/AllOf.html b/doc/Mocha/ParameterMatchers/AllOf.html deleted file mode 100644 index f9531c3f2..000000000 --- a/doc/Mocha/ParameterMatchers/AllOf.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::AllOf - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::AllOf - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/all_of.rb
- -
-
- -

Overview

-
- -

Parameter matcher which combines a number of other matchers using a logical -AND.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/AnyOf.html b/doc/Mocha/ParameterMatchers/AnyOf.html deleted file mode 100644 index 0a764a85c..000000000 --- a/doc/Mocha/ParameterMatchers/AnyOf.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::AnyOf - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::AnyOf - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/any_of.rb
- -
-
- -

Overview

-
- -

Parameter matcher which combines a number of other matchers using a logical -OR.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/AnyParameters.html b/doc/Mocha/ParameterMatchers/AnyParameters.html deleted file mode 100644 index 3e26c8c26..000000000 --- a/doc/Mocha/ParameterMatchers/AnyParameters.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::AnyParameters - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::AnyParameters - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/any_parameters.rb
- -
-
- -

Overview

-
- -

Parameter matcher which always matches whatever the parameters.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/Anything.html b/doc/Mocha/ParameterMatchers/Anything.html deleted file mode 100644 index b58a647ce..000000000 --- a/doc/Mocha/ParameterMatchers/Anything.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::Anything - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::Anything - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/anything.rb
- -
-
- -

Overview

-
- -

Parameter matcher which always matches a single parameter.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/Base.html b/doc/Mocha/ParameterMatchers/Base.html deleted file mode 100644 index a8114848a..000000000 --- a/doc/Mocha/ParameterMatchers/Base.html +++ /dev/null @@ -1,419 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::Base - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::Base - Abstract - - -

- -
- -
Inherits:
-
- Object - -
    -
  • Object
  • - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/base.rb
- -
-
- -

Overview

-
-
- This class is abstract. -
-

Subclass and implement #matches? and #mocha_inspect to -define a custom matcher. Also add a suitably named instance method to -Mocha::ParameterMatchers to build an instance of the new matcher c.f. #equals.

-
-
- - -
-
-
- - -
-

Direct Known Subclasses

-

AllOf, AnyOf, AnyParameters, Anything, Equals, HasEntries, HasEntry, HasKey, HasValue, Includes, InstanceOf, IsA, KindOf, Not, Optionally, QueryStringMatches, RegexpMatches, RespondsWith, YamlEquivalent

-
- - - - - - - - -

- Instance Method Summary - (collapse) -

- - - - - - -
-

Instance Method Details

- - -
-

- - - (AllOf) &(matcher) - - - -

-
- -

A shorthand way of combining two matchers when both must match.

- -

Returns a new AllOf parameter matcher combining two matchers using a -logical AND.

- -

This shorthand will not work with an implicit equals match. Instead, an -explicit Equals matcher should be used.

- - -
-
-
- -
-

Examples:

- -

-

Alternative ways to combine matchers with a logical AND.

-

-
object = mock()
-object.expects(:run).with(all_of(has_key(:foo), has_key(:bar)))
-object.run(:foo => 'foovalue', :bar => 'barvalue')
-
-# is exactly equivalent to
-
-object.expects(:run).with(has_key(:foo) & has_key(:bar))
-object.run(:foo => 'foovalue', :bar => 'barvalue)
- -
-

Parameters:

-
    - -
  • - - matcher - - - (Base) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (AllOf) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-33
-34
-35
-
-
# File 'lib/mocha/parameter_matchers/base.rb', line 33
-
-def &(matcher)
-  AllOf.new(self, matcher)
-end
-
-
- -
-

- - - (AnyOf) |(matcher) - - - -

-
- -

A shorthand way of combining two matchers when at least one must match.

- -

Returns a new AnyOf parameter matcher combining two matchers using -a logical OR.

- -

This shorthand will not work with an implicit equals match. Instead, an -explicit Equals matcher should be used.

- - -
-
-
- -
-

Examples:

- -

-

Alternative ways to combine matchers with a logical OR.

-

-
object = mock()
-object.expects(:run).with(any_of(has_key(:foo), has_key(:bar)))
-object.run(:foo => 'foovalue')
-
-# is exactly equivalent to
-
-object.expects(:run).with(has_key(:foo) | has_key(:bar))
-object.run(:foo => 'foovalue')
- -

-

Using an explicit Equals matcher in combination with #|.

-

-
object.expects(:run).with(equals(1) | equals(2))
-object.run(1) # passes
-object.run(2) # passes
-object.run(3) # fails
- -
-

Parameters:

-
    - -
  • - - matcher - - - (Base) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (AnyOf) - - - - — -
    -

    parameter matcher.

    -
    - -
  • - -
- -

See Also:

- - -
- - - - -
-
-
-
-63
-64
-65
-
-
# File 'lib/mocha/parameter_matchers/base.rb', line 63
-
-def |(matcher)
-  AnyOf.new(self, matcher)
-end
-
-
- -
- -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/Equals.html b/doc/Mocha/ParameterMatchers/Equals.html deleted file mode 100644 index e9e178bc4..000000000 --- a/doc/Mocha/ParameterMatchers/Equals.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::Equals - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::Equals - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/equals.rb
- -
-
- -

Overview

-
- -

Parameter matcher which matches when actual parameter equals expected -value.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/HasEntries.html b/doc/Mocha/ParameterMatchers/HasEntries.html deleted file mode 100644 index 55dcde34a..000000000 --- a/doc/Mocha/ParameterMatchers/HasEntries.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::HasEntries - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::HasEntries - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/has_entries.rb
- -
-
- -

Overview

-
- -

Parameter matcher which matches when actual parameter contains all expected -Hash entries.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/HasEntry.html b/doc/Mocha/ParameterMatchers/HasEntry.html deleted file mode 100644 index e1ff3c51c..000000000 --- a/doc/Mocha/ParameterMatchers/HasEntry.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::HasEntry - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::HasEntry - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/has_entry.rb
- -
-
- -

Overview

-
- -

Parameter matcher which matches when actual parameter contains expected -Hash entry.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/HasKey.html b/doc/Mocha/ParameterMatchers/HasKey.html deleted file mode 100644 index 0c7338ada..000000000 --- a/doc/Mocha/ParameterMatchers/HasKey.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::HasKey - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::HasKey - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/has_key.rb
- -
-
- -

Overview

-
- -

Parameter matcher which matches when actual parameter contains -Hash entry with expected key.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/HasValue.html b/doc/Mocha/ParameterMatchers/HasValue.html deleted file mode 100644 index c6560d151..000000000 --- a/doc/Mocha/ParameterMatchers/HasValue.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::HasValue - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::HasValue - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/has_value.rb
- -
-
- -

Overview

-
- -

Parameter matcher which matches when actual parameter contains -Hash entry with expected value.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/Includes.html b/doc/Mocha/ParameterMatchers/Includes.html deleted file mode 100644 index 49369daec..000000000 --- a/doc/Mocha/ParameterMatchers/Includes.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::Includes - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::Includes - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/includes.rb
- -
-
- -

Overview

-
- -

Parameter matcher which matches when actual parameter includes expected -value.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/InstanceOf.html b/doc/Mocha/ParameterMatchers/InstanceOf.html deleted file mode 100644 index 81612ef21..000000000 --- a/doc/Mocha/ParameterMatchers/InstanceOf.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::InstanceOf - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::InstanceOf - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/instance_of.rb
- -
-
- -

Overview

-
- -

Parameter matcher which matches when actual parameter is an instance of the -specified class.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/IsA.html b/doc/Mocha/ParameterMatchers/IsA.html deleted file mode 100644 index dcbb00f14..000000000 --- a/doc/Mocha/ParameterMatchers/IsA.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::IsA - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::IsA - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/is_a.rb
- -
-
- -

Overview

-
- -

Parameter matcher which matches when actual parameter is a specific class.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/KindOf.html b/doc/Mocha/ParameterMatchers/KindOf.html deleted file mode 100644 index cd2320112..000000000 --- a/doc/Mocha/ParameterMatchers/KindOf.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::KindOf - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::KindOf - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/kind_of.rb
- -
-
- -

Overview

-
- -

Parameter matcher which matches when actual parameter is a kind of -specified class.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/Not.html b/doc/Mocha/ParameterMatchers/Not.html deleted file mode 100644 index c05a1bf80..000000000 --- a/doc/Mocha/ParameterMatchers/Not.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::Not - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::Not - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/not.rb
- -
-
- -

Overview

-
- -

Parameter matcher which inverts the logic of the specified matcher using a -logical NOT operation.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/Optionally.html b/doc/Mocha/ParameterMatchers/Optionally.html deleted file mode 100644 index 3802cee97..000000000 --- a/doc/Mocha/ParameterMatchers/Optionally.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::Optionally - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::Optionally - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/optionally.rb
- -
-
- -

Overview

-
- -

Parameter matcher which allows optional parameters to be specified.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/QueryStringMatches.html b/doc/Mocha/ParameterMatchers/QueryStringMatches.html deleted file mode 100644 index 66a630339..000000000 --- a/doc/Mocha/ParameterMatchers/QueryStringMatches.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::QueryStringMatches - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::QueryStringMatches - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/query_string.rb
- -
-
- -

Overview

-
- -

Parameter matcher which matches URIs with equivalent query strings.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/RegexpMatches.html b/doc/Mocha/ParameterMatchers/RegexpMatches.html deleted file mode 100644 index 1c5bb45e0..000000000 --- a/doc/Mocha/ParameterMatchers/RegexpMatches.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::RegexpMatches - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::RegexpMatches - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/regexp_matches.rb
- -
-
- -

Overview

-
- -

Parameter matcher which matches if specified regular expression matches -actual paramter.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/RespondsWith.html b/doc/Mocha/ParameterMatchers/RespondsWith.html deleted file mode 100644 index 06f406fa9..000000000 --- a/doc/Mocha/ParameterMatchers/RespondsWith.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::RespondsWith - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::RespondsWith - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/responds_with.rb
- -
-
- -

Overview

-
- -

Parameter matcher which matches if actual parameter returns expected result -when specified method is invoked.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/ParameterMatchers/YamlEquivalent.html b/doc/Mocha/ParameterMatchers/YamlEquivalent.html deleted file mode 100644 index cd4b6b067..000000000 --- a/doc/Mocha/ParameterMatchers/YamlEquivalent.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Class: Mocha::ParameterMatchers::YamlEquivalent - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::ParameterMatchers::YamlEquivalent - - - -

- -
- -
Inherits:
-
- Base - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/parameter_matchers/yaml_equivalent.rb
- -
-
- -

Overview

-
- -

Parameter matcher which matches if actual parameter is YAML equivalent of -specified object.

- - -
-
-
- - -
- - - - - - - - - - - - -

Method Summary

- -

Methods inherited from Base

-

#&, #|

- - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/Sequence.html b/doc/Mocha/Sequence.html deleted file mode 100644 index 77e565c12..000000000 --- a/doc/Mocha/Sequence.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - Class: Mocha::Sequence - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::Sequence - - - -

- -
- -
Inherits:
-
- Object - -
    -
  • Object
  • - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/sequence.rb
- -
-
- -

Overview

-
- -

Used to constrain the order in which expectations can occur.

- - -
-
-
- - -

See Also:

- - -
- - - - - - - - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/StateMachine.html b/doc/Mocha/StateMachine.html deleted file mode 100644 index 6270f1fed..000000000 --- a/doc/Mocha/StateMachine.html +++ /dev/null @@ -1,510 +0,0 @@ - - - - - - Class: Mocha::StateMachine - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::StateMachine - - - -

- -
- -
Inherits:
-
- Object - -
    -
  • Object
  • - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/state_machine.rb
- -
-
- -

Overview

-
- -

A state machine that is used to constrain the order of invocations. An -invocation can be constrained to occur when a state #is, or #is_not, -active.

- - -
-
-
- - -

Defined Under Namespace

-

- - - - - Classes: State, StatePredicate - - -

- - - - - - - - -

- Instance Method Summary - (collapse) -

- - - - - - -
-

Instance Method Details

- - -
-

- - - (Object) become(next_state_name) - - - -

-
- -

Put the Mocha::StateMachine into the next_state_name.

- - -
-
-
-

Parameters:

-
    - -
  • - - next_state_name - - - (String) - - - - — -
    -

    name of new state

    -
    - -
  • - -
- - -
- - - - -
-
-
-
-76
-77
-78
-
-
# File 'lib/mocha/state_machine.rb', line 76
-
-def become(next_state_name)
-  @current_state = next_state_name
-end
-
-
- -
-

- - - (State) is(state_name) - - - -

-
- -

Provides a mechanism to change the Mocha::StateMachine into the state specified -by state_name at some point in the future.

- -

Or provides a mechanism to determine whether the Mocha::StateMachine is in the -state specified by state_name at some point in the future.

- - -
-
-
-

Parameters:

-
    - -
  • - - state_name - - - (String) - - - - — -
    -

    name of new state

    -
    - -
  • - -
- -

Returns:

-
    - -
  • - - - (State) - - - - — -
    -

    state which, when activated, will change the Mocha::StateMachine into the state -with the specified state_name.

    -
    - -
  • - -
- -
- - - - -
-
-
-
-86
-87
-88
-
-
# File 'lib/mocha/state_machine.rb', line 86
-
-def is(state_name)
-  State.new(self, state_name)
-end
-
-
- -
-

- - - (Object) is_not(state_name) - - - -

-
- -

Provides a mechanism to determine whether the Mocha::StateMachine is not in the -state specified by state_name at some point in the future.

- - -
-
-
- - -
- - - - -
-
-
-
-91
-92
-93
-
-
# File 'lib/mocha/state_machine.rb', line 91
-
-def is_not(state_name)
-  StatePredicate.new(self, state_name)
-end
-
-
- -
-

- - - (StateMachine) starts_as(initial_state_name) - - - -

-
- -

Put the Mocha::StateMachine into the state specified by -initial_state_name.

- - -
-
-
-

Parameters:

-
    - -
  • - - initial_state_name - - - (String) - - - - — -
    -

    name of initial state

    -
    - -
  • - -
- -

Returns:

- - -
- - - - -
-
-
-
-68
-69
-70
-71
-
-
# File 'lib/mocha/state_machine.rb', line 68
-
-def starts_as(initial_state_name)
-  become(initial_state_name)
-  self
-end
-
-
- -
- -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/StateMachine/State.html b/doc/Mocha/StateMachine/State.html deleted file mode 100644 index f5c217275..000000000 --- a/doc/Mocha/StateMachine/State.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - Class: Mocha::StateMachine::State - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::StateMachine::State - - - -

- -
- -
Inherits:
-
- Object - -
    -
  • Object
  • - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/state_machine.rb
- -
-
- -

Overview

-
- -

Provides a mechanism to change the state of a Mocha::StateMachine at some point -in the future.

- - -
-
-
- - -
- - - - - - - - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/StateMachine/StatePredicate.html b/doc/Mocha/StateMachine/StatePredicate.html deleted file mode 100644 index 4a2c9be71..000000000 --- a/doc/Mocha/StateMachine/StatePredicate.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - Class: Mocha::StateMachine::StatePredicate - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::StateMachine::StatePredicate - - - -

- -
- -
Inherits:
-
- Object - -
    -
  • Object
  • - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/state_machine.rb
- -
-
- -

Overview

-
- -

Provides the ability to determine whether a Mocha::StateMachine is in a -specified state at some point in the future.

- - -
-
-
- - -
- - - - - - - - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/StubbingError.html b/doc/Mocha/StubbingError.html deleted file mode 100644 index 86a2c916c..000000000 --- a/doc/Mocha/StubbingError.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - Exception: Mocha::StubbingError - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Exception: Mocha::StubbingError - - - -

- -
- -
Inherits:
-
- StandardError - -
    -
  • Object
  • - - - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/stubbing_error.rb
- -
-
- -

Overview

-
- -

Exception raised when stubbing a particular method is not allowed.

- - -
-
-
- - -

See Also:

- - -
- - - - - - - - - -
- - - - - \ No newline at end of file diff --git a/doc/Mocha/UnexpectedInvocation.html b/doc/Mocha/UnexpectedInvocation.html deleted file mode 100644 index 7e4244cda..000000000 --- a/doc/Mocha/UnexpectedInvocation.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - Class: Mocha::UnexpectedInvocation - - — Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Class: Mocha::UnexpectedInvocation - - - -

- -
- -
Inherits:
-
- Object - -
    -
  • Object
  • - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/mocha/unexpected_invocation.rb
- -
-
- -

Overview

-
- -

Exception raised when an unexpected method is invoked

- - -
-
-
- - -
- - - - - - - - -
- - - - - \ No newline at end of file diff --git a/doc/_index.html b/doc/_index.html deleted file mode 100644 index 9e3902d7f..000000000 --- a/doc/_index.html +++ /dev/null @@ -1,481 +0,0 @@ - - - - - - Mocha 0.11.3 - - - - - - - - - - - - - - - - - - - - - - -

Mocha 0.11.3

-
-

Alphabetic Index

- -

File Listing

- - -
-

Namespace Listing A-Z

- - - - - - - - -
- - -
    -
  • A
  • -
      - -
    • - API - - (Mocha) - -
    • - -
    • - AllOf - - (Mocha::ParameterMatchers) - -
    • - -
    • - AnyOf - - (Mocha::ParameterMatchers) - -
    • - -
    • - AnyParameters - - (Mocha::ParameterMatchers) - -
    • - -
    • - Anything - - (Mocha::ParameterMatchers) - -
    • - -
    -
- - -
    -
  • B
  • -
      - -
    • - Base - - (Mocha::ParameterMatchers) - -
    • - -
    -
- - - - - -
    -
  • E
  • -
      - -
    • - Equals - - (Mocha::ParameterMatchers) - -
    • - -
    • - Expectation - - (Mocha) - -
    • - -
    -
- - -
    -
  • H
  • -
      - -
    • - HasEntries - - (Mocha::ParameterMatchers) - -
    • - -
    • - HasEntry - - (Mocha::ParameterMatchers) - -
    • - -
    • - HasKey - - (Mocha::ParameterMatchers) - -
    • - -
    • - HasValue - - (Mocha::ParameterMatchers) - -
    • - -
    -
- - -
    -
  • I
  • -
      - -
    • - Includes - - (Mocha::ParameterMatchers) - -
    • - -
    • - InstanceOf - - (Mocha::ParameterMatchers) - -
    • - -
    • - IsA - - (Mocha::ParameterMatchers) - -
    • - -
    -
- - -
    -
  • K
  • -
      - -
    • - KindOf - - (Mocha::ParameterMatchers) - -
    • - -
    -
- - -
- - -
    -
  • M
  • -
      - -
    • - Mocha - -
    • - -
    • - Mock - - (Mocha) - -
    • - -
    -
- - -
    -
  • N
  • -
      - -
    • - Not - - (Mocha::ParameterMatchers) - -
    • - -
    -
- - - - - - - - - - - - - - - - - - - - -
- - - - -
- -
- -
- - - - - \ No newline at end of file diff --git a/doc/class_list.html b/doc/class_list.html deleted file mode 100644 index c42ba523a..000000000 --- a/doc/class_list.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -
-

Class List

- - - - -
- - diff --git a/doc/css/common.css b/doc/css/common.css deleted file mode 100644 index cf25c4523..000000000 --- a/doc/css/common.css +++ /dev/null @@ -1 +0,0 @@ -/* Override this file with custom rules */ \ No newline at end of file diff --git a/doc/css/full_list.css b/doc/css/full_list.css deleted file mode 100644 index 3c032964b..000000000 --- a/doc/css/full_list.css +++ /dev/null @@ -1,55 +0,0 @@ -body { - margin: 0; - font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; - font-size: 13px; - height: 101%; - overflow-x: hidden; -} - -h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } -.clear { clear: both; } -#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } -#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } -#full_list { padding: 0; list-style: none; margin-left: 0; } -#full_list ul { padding: 0; } -#full_list li { padding: 5px; padding-left: 12px; margin: 0; font-size: 1.1em; list-style: none; } -#noresults { padding: 7px 12px; } -#content.insearch #noresults { margin-left: 7px; } -ul.collapsed ul, ul.collapsed li { display: none; } -ul.collapsed.search_uncollapsed { display: block; } -ul.collapsed.search_uncollapsed li { display: list-item; } -li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } -li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } -li { color: #888; cursor: pointer; } -li.deprecated { text-decoration: line-through; font-style: italic; } -li.r1 { background: #f0f0f0; } -li.r2 { background: #fafafa; } -li:hover { background: #ddd; } -li small:before { content: "("; } -li small:after { content: ")"; } -li small.search_info { display: none; } -a:link, a:visited { text-decoration: none; color: #05a; } -li.clicked { background: #05a; color: #ccc; } -li.clicked a:link, li.clicked a:visited { color: #eee; } -li.clicked a.toggle { opacity: 0.5; background-position: bottom right; } -li.collapsed.clicked a.toggle { background-position: top right; } -#search input { border: 1px solid #bbb; -moz-border-radius: 3px; -webkit-border-radius: 3px; } -#nav { margin-left: 10px; font-size: 0.9em; display: none; color: #aaa; } -#nav a:link, #nav a:visited { color: #358; } -#nav a:hover { background: transparent; color: #5af; } - -.frames #content h1 { margin-top: 0; } -.frames li { white-space: nowrap; cursor: normal; } -.frames li small { display: block; font-size: 0.8em; } -.frames li small:before { content: ""; } -.frames li small:after { content: ""; } -.frames li small.search_info { display: none; } -.frames #search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } -.frames #content.insearch #search { background-position: center right; } -.frames #search input { width: 110px; } -.frames #nav { display: block; } - -#full_list.insearch li { display: none; } -#full_list.insearch li.found { display: list-item; padding-left: 10px; } -#full_list.insearch li a.toggle { display: none; } -#full_list.insearch li small.search_info { display: block; } diff --git a/doc/css/style.css b/doc/css/style.css deleted file mode 100644 index c8ff2bf49..000000000 --- a/doc/css/style.css +++ /dev/null @@ -1,322 +0,0 @@ -body { - padding: 0 20px; - font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; - font-size: 13px; -} -body.frames { padding: 0 5px; } -h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } -h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } -h1.title { margin-bottom: 10px; } -h1.alphaindex { margin-top: 0; font-size: 22px; } -h2 { - padding: 0; - padding-bottom: 3px; - border-bottom: 1px #aaa solid; - font-size: 1.4em; - margin: 1.8em 0 0.5em; -} -h2 small { font-weight: normal; font-size: 0.7em; display: block; float: right; } -.clear { clear: both; } -.inline { display: inline; } -.inline p:first-child { display: inline; } -.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; } -.docstring h1 { font-size: 1.2em; } -.docstring h2 { font-size: 1.1em; } -.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; } -.summary_desc .object_link, .docstring .object_link { font-family: monospace; } -.rdoc-term { padding-right: 25px; font-weight: bold; } -.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; } - -/* style for