mocha 1.11.2 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +1 -1
- data/README.md +28 -30
- data/RELEASE.md +25 -0
- data/Rakefile +6 -1
- data/lib/mocha/cardinality.rb +30 -27
- data/lib/mocha/expectation.rb +24 -24
- data/lib/mocha/mock.rb +1 -1
- data/lib/mocha/mockery.rb +9 -22
- data/lib/mocha/state_machine.rb +30 -38
- data/lib/mocha/version.rb +1 -1
- data/mocha.gemspec +3 -1
- metadata +5 -192
- data/docs/CNAME +0 -1
- data/docs/Mocha.html +0 -254
- data/docs/Mocha/API.html +0 -1285
- data/docs/Mocha/ClassMethods.html +0 -264
- data/docs/Mocha/Configuration.html +0 -1525
- data/docs/Mocha/Expectation.html +0 -2862
- data/docs/Mocha/ExpectationError.html +0 -152
- data/docs/Mocha/ExpectationErrorFactory.html +0 -260
- data/docs/Mocha/Hooks.html +0 -370
- data/docs/Mocha/Integration.html +0 -125
- data/docs/Mocha/Integration/MiniTest.html +0 -123
- data/docs/Mocha/Integration/MiniTest/Adapter.html +0 -164
- data/docs/Mocha/Integration/TestUnit.html +0 -123
- data/docs/Mocha/Integration/TestUnit/Adapter.html +0 -164
- data/docs/Mocha/Mock.html +0 -1210
- data/docs/Mocha/ObjectMethods.html +0 -765
- data/docs/Mocha/ParameterMatchers.html +0 -2949
- data/docs/Mocha/ParameterMatchers/AllOf.html +0 -153
- data/docs/Mocha/ParameterMatchers/AnyOf.html +0 -153
- data/docs/Mocha/ParameterMatchers/AnyParameters.html +0 -153
- data/docs/Mocha/ParameterMatchers/Anything.html +0 -153
- data/docs/Mocha/ParameterMatchers/Base.html +0 -441
- data/docs/Mocha/ParameterMatchers/Equals.html +0 -153
- data/docs/Mocha/ParameterMatchers/EquivalentUri.html +0 -153
- data/docs/Mocha/ParameterMatchers/HasEntries.html +0 -153
- data/docs/Mocha/ParameterMatchers/HasEntry.html +0 -153
- data/docs/Mocha/ParameterMatchers/HasKey.html +0 -153
- data/docs/Mocha/ParameterMatchers/HasValue.html +0 -153
- data/docs/Mocha/ParameterMatchers/Includes.html +0 -153
- data/docs/Mocha/ParameterMatchers/InstanceOf.html +0 -153
- data/docs/Mocha/ParameterMatchers/IsA.html +0 -153
- data/docs/Mocha/ParameterMatchers/KindOf.html +0 -153
- data/docs/Mocha/ParameterMatchers/Not.html +0 -153
- data/docs/Mocha/ParameterMatchers/Optionally.html +0 -153
- data/docs/Mocha/ParameterMatchers/RegexpMatches.html +0 -153
- data/docs/Mocha/ParameterMatchers/RespondsWith.html +0 -153
- data/docs/Mocha/ParameterMatchers/YamlEquivalent.html +0 -153
- data/docs/Mocha/Sequence.html +0 -149
- data/docs/Mocha/StateMachine.html +0 -527
- data/docs/Mocha/StateMachine/State.html +0 -140
- data/docs/Mocha/StateMachine/StatePredicate.html +0 -140
- data/docs/Mocha/StubbingError.html +0 -150
- data/docs/_index.html +0 -519
- data/docs/class_list.html +0 -51
- data/docs/css/common.css +0 -1
- data/docs/css/full_list.css +0 -58
- data/docs/css/style.css +0 -496
- data/docs/file.COPYING.html +0 -81
- data/docs/file.MIT-LICENSE.html +0 -85
- data/docs/file.README.html +0 -448
- data/docs/file.RELEASE.html +0 -1028
- data/docs/file_list.html +0 -71
- data/docs/frames.html +0 -17
- data/docs/index.html +0 -448
- data/docs/js/app.js +0 -303
- data/docs/js/full_list.js +0 -216
- data/docs/js/jquery.js +0 -4
- data/docs/method_list.html +0 -651
- data/docs/top-level-namespace.html +0 -118
- data/test/acceptance/acceptance_test_helper.rb +0 -42
- data/test/acceptance/bug_18914_test.rb +0 -37
- data/test/acceptance/bug_21465_test.rb +0 -31
- data/test/acceptance/bug_21563_test.rb +0 -22
- data/test/acceptance/display_matching_invocations_alongside_expectations_test.rb +0 -69
- data/test/acceptance/exception_rescue_test.rb +0 -53
- data/test/acceptance/expectations_on_multiple_methods_test.rb +0 -55
- data/test/acceptance/expected_invocation_count_test.rb +0 -229
- data/test/acceptance/failure_messages_test.rb +0 -77
- data/test/acceptance/issue_272_test.rb +0 -50
- data/test/acceptance/issue_457_test.rb +0 -31
- data/test/acceptance/issue_65_test.rb +0 -64
- data/test/acceptance/issue_70_test.rb +0 -53
- data/test/acceptance/mocha_example_test.rb +0 -106
- data/test/acceptance/mocha_test_result_test.rb +0 -83
- data/test/acceptance/mock_built_with_first_argument_type_being_string_test.rb +0 -98
- data/test/acceptance/mock_test.rb +0 -191
- data/test/acceptance/mocked_methods_dispatch_test.rb +0 -75
- data/test/acceptance/multiple_expectations_failure_message_test.rb +0 -66
- data/test/acceptance/multiple_yielding_test.rb +0 -59
- data/test/acceptance/optional_parameters_test.rb +0 -67
- data/test/acceptance/parameter_matcher_test.rb +0 -299
- data/test/acceptance/partial_mocks_test.rb +0 -44
- data/test/acceptance/prepend_test.rb +0 -86
- data/test/acceptance/prevent_use_of_mocha_outside_test_test.rb +0 -76
- data/test/acceptance/raise_exception_test.rb +0 -36
- data/test/acceptance/return_value_test.rb +0 -49
- data/test/acceptance/sequence_test.rb +0 -189
- data/test/acceptance/states_test.rb +0 -71
- data/test/acceptance/stub_any_instance_method_defined_on_superclass_test.rb +0 -64
- data/test/acceptance/stub_any_instance_method_test.rb +0 -301
- data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +0 -105
- data/test/acceptance/stub_class_method_defined_on_class_test.rb +0 -78
- data/test/acceptance/stub_class_method_defined_on_module_test.rb +0 -73
- data/test/acceptance/stub_class_method_defined_on_superclass_test.rb +0 -144
- data/test/acceptance/stub_everything_test.rb +0 -53
- data/test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb +0 -91
- data/test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb +0 -67
- data/test/acceptance/stub_instance_method_defined_on_class_test.rb +0 -67
- data/test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb +0 -136
- data/test/acceptance/stub_instance_method_defined_on_module_test.rb +0 -76
- data/test/acceptance/stub_instance_method_defined_on_object_class_test.rb +0 -75
- data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +0 -67
- data/test/acceptance/stub_instance_method_defined_on_superclass_test.rb +0 -70
- data/test/acceptance/stub_method_defined_on_module_and_aliased_test.rb +0 -38
- data/test/acceptance/stub_module_method_test.rb +0 -200
- data/test/acceptance/stub_test.rb +0 -49
- data/test/acceptance/stubba_example_test.rb +0 -103
- data/test/acceptance/stubba_test_result_test.rb +0 -71
- data/test/acceptance/stubbing_error_backtrace_test.rb +0 -63
- data/test/acceptance/stubbing_frozen_object_test.rb +0 -88
- data/test/acceptance/stubbing_method_accepting_block_parameter_test.rb +0 -52
- data/test/acceptance/stubbing_method_unnecessarily_test.rb +0 -63
- data/test/acceptance/stubbing_nil_test.rb +0 -60
- data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +0 -157
- data/test/acceptance/stubbing_non_existent_class_method_test.rb +0 -157
- data/test/acceptance/stubbing_non_existent_instance_method_test.rb +0 -145
- data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +0 -128
- data/test/acceptance/stubbing_non_public_class_method_test.rb +0 -163
- data/test/acceptance/stubbing_non_public_instance_method_test.rb +0 -141
- data/test/acceptance/stubbing_on_non_mock_object_test.rb +0 -70
- data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +0 -33
- data/test/acceptance/throw_test.rb +0 -42
- data/test/acceptance/unexpected_invocation_test.rb +0 -23
- data/test/acceptance/unstubbing_test.rb +0 -194
- data/test/acceptance/yielding_test.rb +0 -80
- data/test/assertions.rb +0 -8
- data/test/deprecation_disabler.rb +0 -15
- data/test/execution_point.rb +0 -36
- data/test/integration/mini_test_test.rb +0 -8
- data/test/integration/shared_tests.rb +0 -178
- data/test/integration/test_unit_test.rb +0 -8
- data/test/method_definer.rb +0 -16
- data/test/mini_test_result.rb +0 -96
- data/test/minitest_result.rb +0 -48
- data/test/simple_counter.rb +0 -11
- data/test/test_helper.rb +0 -58
- data/test/test_runner.rb +0 -58
- data/test/test_unit_result.rb +0 -22
- data/test/unit/any_instance_method_test.rb +0 -175
- data/test/unit/array_inspect_test.rb +0 -14
- data/test/unit/backtrace_filter_test.rb +0 -17
- data/test/unit/cardinality_test.rb +0 -72
- data/test/unit/central_test.rb +0 -98
- data/test/unit/change_state_side_effect_test.rb +0 -37
- data/test/unit/class_methods_test.rb +0 -69
- data/test/unit/configuration_test.rb +0 -37
- data/test/unit/date_time_inspect_test.rb +0 -19
- data/test/unit/exception_raiser_test.rb +0 -45
- data/test/unit/expectation_list_test.rb +0 -82
- data/test/unit/expectation_test.rb +0 -504
- data/test/unit/hash_inspect_test.rb +0 -14
- data/test/unit/hooks_test.rb +0 -35
- data/test/unit/in_state_ordering_constraint_test.rb +0 -39
- data/test/unit/instance_method_test.rb +0 -282
- data/test/unit/method_matcher_test.rb +0 -26
- data/test/unit/mock_test.rb +0 -372
- data/test/unit/mockery_test.rb +0 -171
- data/test/unit/module_methods_test.rb +0 -16
- data/test/unit/object_inspect_test.rb +0 -60
- data/test/unit/object_methods_test.rb +0 -63
- data/test/unit/parameter_matchers/all_of_test.rb +0 -24
- data/test/unit/parameter_matchers/any_of_test.rb +0 -24
- data/test/unit/parameter_matchers/anything_test.rb +0 -19
- data/test/unit/parameter_matchers/equals_test.rb +0 -23
- data/test/unit/parameter_matchers/equivalent_uri_test.rb +0 -41
- data/test/unit/parameter_matchers/has_entries_test.rb +0 -51
- data/test/unit/parameter_matchers/has_entry_test.rb +0 -128
- data/test/unit/parameter_matchers/has_key_test.rb +0 -54
- data/test/unit/parameter_matchers/has_value_test.rb +0 -55
- data/test/unit/parameter_matchers/includes_test.rb +0 -106
- data/test/unit/parameter_matchers/instance_of_test.rb +0 -23
- data/test/unit/parameter_matchers/is_a_test.rb +0 -23
- data/test/unit/parameter_matchers/kind_of_test.rb +0 -23
- data/test/unit/parameter_matchers/not_test.rb +0 -24
- data/test/unit/parameter_matchers/regexp_matches_test.rb +0 -45
- data/test/unit/parameter_matchers/responds_with_test.rb +0 -38
- data/test/unit/parameter_matchers/stub_matcher.rb +0 -23
- data/test/unit/parameter_matchers/yaml_equivalent_test.rb +0 -23
- data/test/unit/parameters_matcher_test.rb +0 -119
- data/test/unit/receivers_test.rb +0 -96
- data/test/unit/return_values_test.rb +0 -66
- data/test/unit/sequence_test.rb +0 -100
- data/test/unit/single_return_value_test.rb +0 -17
- data/test/unit/state_machine_test.rb +0 -96
- data/test/unit/string_inspect_test.rb +0 -9
- data/test/unit/thrower_test.rb +0 -23
- data/test/unit/yield_parameters_test.rb +0 -73
data/lib/mocha/state_machine.rb
CHANGED
@@ -2,46 +2,32 @@ module Mocha
|
|
2
2
|
# A state machine that is used to constrain the order of invocations.
|
3
3
|
# An invocation can be constrained to occur when a state {#is}, or {#is_not}, active.
|
4
4
|
class StateMachine
|
5
|
-
# Provides
|
6
|
-
class
|
5
|
+
# Provides the ability to determine whether a {StateMachine} is in a specified state at some point in the future.
|
6
|
+
class StatePredicate
|
7
7
|
# @private
|
8
|
-
def initialize(state_machine, state)
|
8
|
+
def initialize(state_machine, state, description, &active_check)
|
9
9
|
@state_machine = state_machine
|
10
10
|
@state = state
|
11
|
-
|
12
|
-
|
13
|
-
# @private
|
14
|
-
def activate
|
15
|
-
@state_machine.current_state = @state
|
11
|
+
@description = description
|
12
|
+
@active_check = active_check
|
16
13
|
end
|
17
14
|
|
18
15
|
# @private
|
19
16
|
def active?
|
20
|
-
@state_machine.current_state
|
17
|
+
@active_check.call(@state_machine.current_state, @state)
|
21
18
|
end
|
22
19
|
|
23
20
|
# @private
|
24
21
|
def mocha_inspect
|
25
|
-
"#{@state_machine.name}
|
22
|
+
"#{@state_machine.name} #{@description} #{@state.mocha_inspect}"
|
26
23
|
end
|
27
24
|
end
|
28
25
|
|
29
|
-
# Provides
|
30
|
-
class StatePredicate
|
31
|
-
# @private
|
32
|
-
def initialize(state_machine, state)
|
33
|
-
@state_machine = state_machine
|
34
|
-
@state = state
|
35
|
-
end
|
36
|
-
|
37
|
-
# @private
|
38
|
-
def active?
|
39
|
-
@state_machine.current_state != @state
|
40
|
-
end
|
41
|
-
|
26
|
+
# Provides a mechanism to change the state of a {StateMachine} at some point in the future.
|
27
|
+
class State < StatePredicate
|
42
28
|
# @private
|
43
|
-
def
|
44
|
-
|
29
|
+
def activate
|
30
|
+
@state_machine.current_state = @state
|
45
31
|
end
|
46
32
|
end
|
47
33
|
|
@@ -73,29 +59,35 @@ module Mocha
|
|
73
59
|
@current_state = next_state_name
|
74
60
|
end
|
75
61
|
|
76
|
-
# Provides a
|
62
|
+
# Provides mechanisms to (a) determine whether the {StateMachine} is in a given state; or (b) to change the {StateMachine} into the given state.
|
63
|
+
#
|
64
|
+
# @param [String] state_name name of expected/desired state.
|
65
|
+
# @return [StatePredicate,State] (a) state predicate which, when queried, will indicate whether the {StateMachine} is in the given state; or (b) state which, when activated, will change the {StateMachine} into the given state.
|
77
66
|
#
|
78
|
-
#
|
67
|
+
# @overload def is(expected_state_name)
|
68
|
+
# Provides a mechanism to determine whether the {StateMachine} is in the state specified by +expected_state_name+ at some point in the future
|
69
|
+
# @param [String] expected_state_name name of expected state.
|
70
|
+
# @return [StatePredicate] state predicate which, when queried, will indicate whether the {StateMachine} is in the state specified by +expected_state_name+
|
79
71
|
#
|
80
|
-
# @
|
81
|
-
#
|
72
|
+
# @overload def is(desired_state_name)
|
73
|
+
# Provides a mechanism to change the {StateMachine} into the state specified by +desired_state_name+ at some point in the future.
|
74
|
+
# @param [String] desired_state_name name of desired new state.
|
75
|
+
# @return [State] state which, when activated, will change the {StateMachine} into the state with the specified +desired_state_name+.
|
82
76
|
def is(state_name)
|
83
|
-
State.new(self, state_name)
|
77
|
+
State.new(self, state_name, 'is') { |current, given| current == given }
|
84
78
|
end
|
85
79
|
|
86
|
-
# Provides a mechanism to determine whether the {StateMachine} is not in the state specified by +
|
80
|
+
# Provides a mechanism to determine whether the {StateMachine} is *not* in the state specified by +unexpected_state_name+ at some point in the future.
|
87
81
|
#
|
88
|
-
|
89
|
-
|
82
|
+
# @param [String] unexpected_state_name name of unexpected state.
|
83
|
+
# @return [StatePredicate] state predicate which, when queried, will indicate whether the {StateMachine} is *not* in the state specified by +unexpected_state_name+.
|
84
|
+
def is_not(unexpected_state_name) # rubocop:disable Naming/PredicateName
|
85
|
+
StatePredicate.new(self, unexpected_state_name, 'is not') { |current, given| current != given }
|
90
86
|
end
|
91
87
|
|
92
88
|
# @private
|
93
89
|
def mocha_inspect
|
94
|
-
|
95
|
-
"#{@name} is #{@current_state.mocha_inspect}"
|
96
|
-
else
|
97
|
-
"#{@name} has no current state"
|
98
|
-
end
|
90
|
+
%(#{@name} #{@current_state ? "is #{@current_state.mocha_inspect}" : 'has no current state'})
|
99
91
|
end
|
100
92
|
end
|
101
93
|
end
|
data/lib/mocha/version.rb
CHANGED
data/mocha.gemspec
CHANGED
@@ -12,7 +12,9 @@ Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength
|
|
12
12
|
s.description = 'Mocking and stubbing library with JMock/SchMock syntax, which allows mocking and stubbing of methods on real (non-mock) classes.'
|
13
13
|
s.email = 'mocha-developer@googlegroups.com'
|
14
14
|
|
15
|
-
s.files =
|
15
|
+
s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
16
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(docs|test)/}) }
|
17
|
+
end
|
16
18
|
s.files.delete('.travis.yml')
|
17
19
|
s.files.delete('.gitignore')
|
18
20
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mocha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Mead
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -86,65 +86,6 @@ files:
|
|
86
86
|
- RELEASE.md
|
87
87
|
- Rakefile
|
88
88
|
- bin/build-matrix
|
89
|
-
- docs/CNAME
|
90
|
-
- docs/Mocha.html
|
91
|
-
- docs/Mocha/API.html
|
92
|
-
- docs/Mocha/ClassMethods.html
|
93
|
-
- docs/Mocha/Configuration.html
|
94
|
-
- docs/Mocha/Expectation.html
|
95
|
-
- docs/Mocha/ExpectationError.html
|
96
|
-
- docs/Mocha/ExpectationErrorFactory.html
|
97
|
-
- docs/Mocha/Hooks.html
|
98
|
-
- docs/Mocha/Integration.html
|
99
|
-
- docs/Mocha/Integration/MiniTest.html
|
100
|
-
- docs/Mocha/Integration/MiniTest/Adapter.html
|
101
|
-
- docs/Mocha/Integration/TestUnit.html
|
102
|
-
- docs/Mocha/Integration/TestUnit/Adapter.html
|
103
|
-
- docs/Mocha/Mock.html
|
104
|
-
- docs/Mocha/ObjectMethods.html
|
105
|
-
- docs/Mocha/ParameterMatchers.html
|
106
|
-
- docs/Mocha/ParameterMatchers/AllOf.html
|
107
|
-
- docs/Mocha/ParameterMatchers/AnyOf.html
|
108
|
-
- docs/Mocha/ParameterMatchers/AnyParameters.html
|
109
|
-
- docs/Mocha/ParameterMatchers/Anything.html
|
110
|
-
- docs/Mocha/ParameterMatchers/Base.html
|
111
|
-
- docs/Mocha/ParameterMatchers/Equals.html
|
112
|
-
- docs/Mocha/ParameterMatchers/EquivalentUri.html
|
113
|
-
- docs/Mocha/ParameterMatchers/HasEntries.html
|
114
|
-
- docs/Mocha/ParameterMatchers/HasEntry.html
|
115
|
-
- docs/Mocha/ParameterMatchers/HasKey.html
|
116
|
-
- docs/Mocha/ParameterMatchers/HasValue.html
|
117
|
-
- docs/Mocha/ParameterMatchers/Includes.html
|
118
|
-
- docs/Mocha/ParameterMatchers/InstanceOf.html
|
119
|
-
- docs/Mocha/ParameterMatchers/IsA.html
|
120
|
-
- docs/Mocha/ParameterMatchers/KindOf.html
|
121
|
-
- docs/Mocha/ParameterMatchers/Not.html
|
122
|
-
- docs/Mocha/ParameterMatchers/Optionally.html
|
123
|
-
- docs/Mocha/ParameterMatchers/RegexpMatches.html
|
124
|
-
- docs/Mocha/ParameterMatchers/RespondsWith.html
|
125
|
-
- docs/Mocha/ParameterMatchers/YamlEquivalent.html
|
126
|
-
- docs/Mocha/Sequence.html
|
127
|
-
- docs/Mocha/StateMachine.html
|
128
|
-
- docs/Mocha/StateMachine/State.html
|
129
|
-
- docs/Mocha/StateMachine/StatePredicate.html
|
130
|
-
- docs/Mocha/StubbingError.html
|
131
|
-
- docs/_index.html
|
132
|
-
- docs/class_list.html
|
133
|
-
- docs/css/common.css
|
134
|
-
- docs/css/full_list.css
|
135
|
-
- docs/css/style.css
|
136
|
-
- docs/file.COPYING.html
|
137
|
-
- docs/file.MIT-LICENSE.html
|
138
|
-
- docs/file.README.html
|
139
|
-
- docs/file.RELEASE.html
|
140
|
-
- docs/file_list.html
|
141
|
-
- docs/frames.html
|
142
|
-
- docs/index.html
|
143
|
-
- docs/js/app.js
|
144
|
-
- docs/js/full_list.js
|
145
|
-
- docs/js/jquery.js
|
146
|
-
- docs/method_list.html
|
147
|
-
- docs/top-level-namespace.html
|
148
89
|
- gemfiles/Gemfile.minitest.1.3.0
|
149
90
|
- gemfiles/Gemfile.minitest.1.4.0
|
150
91
|
- gemfiles/Gemfile.minitest.1.4.1
|
@@ -262,134 +203,6 @@ files:
|
|
262
203
|
- lib/mocha/version.rb
|
263
204
|
- lib/mocha/yield_parameters.rb
|
264
205
|
- mocha.gemspec
|
265
|
-
- test/acceptance/acceptance_test_helper.rb
|
266
|
-
- test/acceptance/bug_18914_test.rb
|
267
|
-
- test/acceptance/bug_21465_test.rb
|
268
|
-
- test/acceptance/bug_21563_test.rb
|
269
|
-
- test/acceptance/display_matching_invocations_alongside_expectations_test.rb
|
270
|
-
- test/acceptance/exception_rescue_test.rb
|
271
|
-
- test/acceptance/expectations_on_multiple_methods_test.rb
|
272
|
-
- test/acceptance/expected_invocation_count_test.rb
|
273
|
-
- test/acceptance/failure_messages_test.rb
|
274
|
-
- test/acceptance/issue_272_test.rb
|
275
|
-
- test/acceptance/issue_457_test.rb
|
276
|
-
- test/acceptance/issue_65_test.rb
|
277
|
-
- test/acceptance/issue_70_test.rb
|
278
|
-
- test/acceptance/mocha_example_test.rb
|
279
|
-
- test/acceptance/mocha_test_result_test.rb
|
280
|
-
- test/acceptance/mock_built_with_first_argument_type_being_string_test.rb
|
281
|
-
- test/acceptance/mock_test.rb
|
282
|
-
- test/acceptance/mocked_methods_dispatch_test.rb
|
283
|
-
- test/acceptance/multiple_expectations_failure_message_test.rb
|
284
|
-
- test/acceptance/multiple_yielding_test.rb
|
285
|
-
- test/acceptance/optional_parameters_test.rb
|
286
|
-
- test/acceptance/parameter_matcher_test.rb
|
287
|
-
- test/acceptance/partial_mocks_test.rb
|
288
|
-
- test/acceptance/prepend_test.rb
|
289
|
-
- test/acceptance/prevent_use_of_mocha_outside_test_test.rb
|
290
|
-
- test/acceptance/raise_exception_test.rb
|
291
|
-
- test/acceptance/return_value_test.rb
|
292
|
-
- test/acceptance/sequence_test.rb
|
293
|
-
- test/acceptance/states_test.rb
|
294
|
-
- test/acceptance/stub_any_instance_method_defined_on_superclass_test.rb
|
295
|
-
- test/acceptance/stub_any_instance_method_test.rb
|
296
|
-
- test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb
|
297
|
-
- test/acceptance/stub_class_method_defined_on_class_test.rb
|
298
|
-
- test/acceptance/stub_class_method_defined_on_module_test.rb
|
299
|
-
- test/acceptance/stub_class_method_defined_on_superclass_test.rb
|
300
|
-
- test/acceptance/stub_everything_test.rb
|
301
|
-
- test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb
|
302
|
-
- test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb
|
303
|
-
- test/acceptance/stub_instance_method_defined_on_class_test.rb
|
304
|
-
- test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb
|
305
|
-
- test/acceptance/stub_instance_method_defined_on_module_test.rb
|
306
|
-
- test/acceptance/stub_instance_method_defined_on_object_class_test.rb
|
307
|
-
- test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb
|
308
|
-
- test/acceptance/stub_instance_method_defined_on_superclass_test.rb
|
309
|
-
- test/acceptance/stub_method_defined_on_module_and_aliased_test.rb
|
310
|
-
- test/acceptance/stub_module_method_test.rb
|
311
|
-
- test/acceptance/stub_test.rb
|
312
|
-
- test/acceptance/stubba_example_test.rb
|
313
|
-
- test/acceptance/stubba_test_result_test.rb
|
314
|
-
- test/acceptance/stubbing_error_backtrace_test.rb
|
315
|
-
- test/acceptance/stubbing_frozen_object_test.rb
|
316
|
-
- test/acceptance/stubbing_method_accepting_block_parameter_test.rb
|
317
|
-
- test/acceptance/stubbing_method_unnecessarily_test.rb
|
318
|
-
- test/acceptance/stubbing_nil_test.rb
|
319
|
-
- test/acceptance/stubbing_non_existent_any_instance_method_test.rb
|
320
|
-
- test/acceptance/stubbing_non_existent_class_method_test.rb
|
321
|
-
- test/acceptance/stubbing_non_existent_instance_method_test.rb
|
322
|
-
- test/acceptance/stubbing_non_public_any_instance_method_test.rb
|
323
|
-
- test/acceptance/stubbing_non_public_class_method_test.rb
|
324
|
-
- test/acceptance/stubbing_non_public_instance_method_test.rb
|
325
|
-
- test/acceptance/stubbing_on_non_mock_object_test.rb
|
326
|
-
- test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb
|
327
|
-
- test/acceptance/throw_test.rb
|
328
|
-
- test/acceptance/unexpected_invocation_test.rb
|
329
|
-
- test/acceptance/unstubbing_test.rb
|
330
|
-
- test/acceptance/yielding_test.rb
|
331
|
-
- test/assertions.rb
|
332
|
-
- test/deprecation_disabler.rb
|
333
|
-
- test/execution_point.rb
|
334
|
-
- test/integration/mini_test_test.rb
|
335
|
-
- test/integration/shared_tests.rb
|
336
|
-
- test/integration/test_unit_test.rb
|
337
|
-
- test/method_definer.rb
|
338
|
-
- test/mini_test_result.rb
|
339
|
-
- test/minitest_result.rb
|
340
|
-
- test/simple_counter.rb
|
341
|
-
- test/test_helper.rb
|
342
|
-
- test/test_runner.rb
|
343
|
-
- test/test_unit_result.rb
|
344
|
-
- test/unit/any_instance_method_test.rb
|
345
|
-
- test/unit/array_inspect_test.rb
|
346
|
-
- test/unit/backtrace_filter_test.rb
|
347
|
-
- test/unit/cardinality_test.rb
|
348
|
-
- test/unit/central_test.rb
|
349
|
-
- test/unit/change_state_side_effect_test.rb
|
350
|
-
- test/unit/class_methods_test.rb
|
351
|
-
- test/unit/configuration_test.rb
|
352
|
-
- test/unit/date_time_inspect_test.rb
|
353
|
-
- test/unit/exception_raiser_test.rb
|
354
|
-
- test/unit/expectation_list_test.rb
|
355
|
-
- test/unit/expectation_test.rb
|
356
|
-
- test/unit/hash_inspect_test.rb
|
357
|
-
- test/unit/hooks_test.rb
|
358
|
-
- test/unit/in_state_ordering_constraint_test.rb
|
359
|
-
- test/unit/instance_method_test.rb
|
360
|
-
- test/unit/method_matcher_test.rb
|
361
|
-
- test/unit/mock_test.rb
|
362
|
-
- test/unit/mockery_test.rb
|
363
|
-
- test/unit/module_methods_test.rb
|
364
|
-
- test/unit/object_inspect_test.rb
|
365
|
-
- test/unit/object_methods_test.rb
|
366
|
-
- test/unit/parameter_matchers/all_of_test.rb
|
367
|
-
- test/unit/parameter_matchers/any_of_test.rb
|
368
|
-
- test/unit/parameter_matchers/anything_test.rb
|
369
|
-
- test/unit/parameter_matchers/equals_test.rb
|
370
|
-
- test/unit/parameter_matchers/equivalent_uri_test.rb
|
371
|
-
- test/unit/parameter_matchers/has_entries_test.rb
|
372
|
-
- test/unit/parameter_matchers/has_entry_test.rb
|
373
|
-
- test/unit/parameter_matchers/has_key_test.rb
|
374
|
-
- test/unit/parameter_matchers/has_value_test.rb
|
375
|
-
- test/unit/parameter_matchers/includes_test.rb
|
376
|
-
- test/unit/parameter_matchers/instance_of_test.rb
|
377
|
-
- test/unit/parameter_matchers/is_a_test.rb
|
378
|
-
- test/unit/parameter_matchers/kind_of_test.rb
|
379
|
-
- test/unit/parameter_matchers/not_test.rb
|
380
|
-
- test/unit/parameter_matchers/regexp_matches_test.rb
|
381
|
-
- test/unit/parameter_matchers/responds_with_test.rb
|
382
|
-
- test/unit/parameter_matchers/stub_matcher.rb
|
383
|
-
- test/unit/parameter_matchers/yaml_equivalent_test.rb
|
384
|
-
- test/unit/parameters_matcher_test.rb
|
385
|
-
- test/unit/receivers_test.rb
|
386
|
-
- test/unit/return_values_test.rb
|
387
|
-
- test/unit/sequence_test.rb
|
388
|
-
- test/unit/single_return_value_test.rb
|
389
|
-
- test/unit/state_machine_test.rb
|
390
|
-
- test/unit/string_inspect_test.rb
|
391
|
-
- test/unit/thrower_test.rb
|
392
|
-
- test/unit/yield_parameters_test.rb
|
393
206
|
- yard-templates/default/layout/html/google_analytics.erb
|
394
207
|
- yard-templates/default/layout/html/setup.rb
|
395
208
|
homepage: https://mocha.jamesmead.org
|
@@ -397,7 +210,7 @@ licenses:
|
|
397
210
|
- MIT
|
398
211
|
- BSD-2-Clause
|
399
212
|
metadata: {}
|
400
|
-
post_install_message:
|
213
|
+
post_install_message:
|
401
214
|
rdoc_options: []
|
402
215
|
require_paths:
|
403
216
|
- lib
|
@@ -413,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
413
226
|
version: '0'
|
414
227
|
requirements: []
|
415
228
|
rubygems_version: 3.0.3
|
416
|
-
signing_key:
|
229
|
+
signing_key:
|
417
230
|
specification_version: 4
|
418
231
|
summary: Mocking and stubbing library
|
419
232
|
test_files: []
|
data/docs/CNAME
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
mocha.jamesmead.org
|
data/docs/Mocha.html
DELETED
@@ -1,254 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>
|
7
|
-
Module: Mocha
|
8
|
-
|
9
|
-
— Mocha 1.11.2
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
pathId = "Mocha";
|
19
|
-
relpath = '';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
|
23
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
-
|
27
|
-
|
28
|
-
</head>
|
29
|
-
<body>
|
30
|
-
<div class="nav_wrap">
|
31
|
-
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
-
<div id="resizer"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="main" tabindex="-1">
|
36
|
-
<div id="header">
|
37
|
-
<div id="menu">
|
38
|
-
|
39
|
-
<a href="_index.html">Index (M)</a> »
|
40
|
-
|
41
|
-
|
42
|
-
<span class="title">Mocha</span>
|
43
|
-
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<div id="search">
|
47
|
-
|
48
|
-
<a class="full_list_link" id="class_list_link"
|
49
|
-
href="class_list.html">
|
50
|
-
|
51
|
-
<svg width="24" height="24">
|
52
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
-
</svg>
|
56
|
-
</a>
|
57
|
-
|
58
|
-
</div>
|
59
|
-
<div class="clear"></div>
|
60
|
-
</div>
|
61
|
-
|
62
|
-
<div id="content"><h1>Module: Mocha
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
</h1>
|
67
|
-
<div class="box_info">
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<dl>
|
80
|
-
<dt>Defined in:</dt>
|
81
|
-
<dd>lib/mocha/api.rb<span class="defines">,<br />
|
82
|
-
lib/mocha/hooks.rb,<br /> lib/mocha/mock.rb,<br /> lib/mocha/expectation.rb,<br /> lib/mocha/object_methods.rb,<br /> lib/mocha/class_methods.rb,<br /> lib/mocha/parameter_matchers.rb,<br /> lib/mocha/parameter_matchers/not.rb,<br /> lib/mocha/parameter_matchers/base.rb,<br /> lib/mocha/parameter_matchers/is_a.rb,<br /> lib/mocha/parameter_matchers/all_of.rb,<br /> lib/mocha/parameter_matchers/any_of.rb,<br /> lib/mocha/parameter_matchers/equals.rb,<br /> lib/mocha/parameter_matchers/has_key.rb,<br /> lib/mocha/parameter_matchers/kind_of.rb,<br /> lib/mocha/parameter_matchers/anything.rb,<br /> lib/mocha/parameter_matchers/includes.rb,<br /> lib/mocha/parameter_matchers/has_entry.rb,<br /> lib/mocha/parameter_matchers/has_value.rb,<br /> lib/mocha/parameter_matchers/optionally.rb,<br /> lib/mocha/parameter_matchers/has_entries.rb,<br /> lib/mocha/parameter_matchers/instance_of.rb,<br /> lib/mocha/parameter_matchers/responds_with.rb,<br /> lib/mocha/parameter_matchers/any_parameters.rb,<br /> lib/mocha/parameter_matchers/equivalent_uri.rb,<br /> lib/mocha/parameter_matchers/regexp_matches.rb,<br /> lib/mocha/parameter_matchers/yaml_equivalent.rb,<br /> lib/mocha/parameter_matchers/instance_methods.rb,<br /> lib/mocha/state_machine.rb,<br /> lib/mocha/sequence.rb,<br /> lib/mocha/configuration.rb,<br /> lib/mocha/expectation_error_factory.rb,<br /> lib/mocha/expectation_error.rb,<br /> lib/mocha/stubbing_error.rb,<br /> lib/mocha/integration/test_unit/adapter.rb,<br /> lib/mocha/integration/mini_test/adapter.rb</span>
|
83
|
-
</dd>
|
84
|
-
</dl>
|
85
|
-
|
86
|
-
</div>
|
87
|
-
|
88
|
-
<h2>Defined Under Namespace</h2>
|
89
|
-
<p class="children">
|
90
|
-
|
91
|
-
|
92
|
-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Mocha/API.html" title="Mocha::API (module)">API</a></span>, <span class='object_link'><a href="Mocha/ClassMethods.html" title="Mocha::ClassMethods (module)">ClassMethods</a></span>, <span class='object_link'><a href="Mocha/Hooks.html" title="Mocha::Hooks (module)">Hooks</a></span>, <span class='object_link'><a href="Mocha/Integration.html" title="Mocha::Integration (module)">Integration</a></span>, <span class='object_link'><a href="Mocha/ObjectMethods.html" title="Mocha::ObjectMethods (module)">ObjectMethods</a></span>, <span class='object_link'><a href="Mocha/ParameterMatchers.html" title="Mocha::ParameterMatchers (module)">ParameterMatchers</a></span>
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Mocha/Configuration.html" title="Mocha::Configuration (class)">Configuration</a></span>, <span class='object_link'><a href="Mocha/Expectation.html" title="Mocha::Expectation (class)">Expectation</a></span>, <span class='object_link'><a href="Mocha/ExpectationError.html" title="Mocha::ExpectationError (class)">ExpectationError</a></span>, <span class='object_link'><a href="Mocha/ExpectationErrorFactory.html" title="Mocha::ExpectationErrorFactory (class)">ExpectationErrorFactory</a></span>, <span class='object_link'><a href="Mocha/Mock.html" title="Mocha::Mock (class)">Mock</a></span>, <span class='object_link'><a href="Mocha/Sequence.html" title="Mocha::Sequence (class)">Sequence</a></span>, <span class='object_link'><a href="Mocha/StateMachine.html" title="Mocha::StateMachine (class)">StateMachine</a></span>, <span class='object_link'><a href="Mocha/StubbingError.html" title="Mocha::StubbingError (class)">StubbingError</a></span>
|
97
|
-
|
98
|
-
|
99
|
-
</p>
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
<h2>
|
109
|
-
Class Method Summary
|
110
|
-
<small><a href="#" class="summary_toggle">collapse</a></small>
|
111
|
-
</h2>
|
112
|
-
|
113
|
-
<ul class="summary">
|
114
|
-
|
115
|
-
<li class="public ">
|
116
|
-
<span class="summary_signature">
|
117
|
-
|
118
|
-
<a href="#configure-class_method" title="configure (class method)">.<strong>configure</strong> {|configuration| ... } ⇒ Object </a>
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
</span>
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
<span class="summary_desc"><div class='inline'>
|
133
|
-
<p>Allows setting of configuration options.</p>
|
134
|
-
</div></span>
|
135
|
-
|
136
|
-
</li>
|
137
|
-
|
138
|
-
|
139
|
-
</ul>
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
<div id="class_method_details" class="method_details_list">
|
145
|
-
<h2>Class Method Details</h2>
|
146
|
-
|
147
|
-
|
148
|
-
<div class="method_details first">
|
149
|
-
<h3 class="signature first" id="configure-class_method">
|
150
|
-
|
151
|
-
.<strong>configure</strong> {|configuration| ... } ⇒ <tt><span class='object_link'>Object</span></tt>
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
</h3><div class="docstring">
|
158
|
-
<div class="discussion">
|
159
|
-
|
160
|
-
<p>Allows setting of configuration options. See <span class='object_link'><a href="Mocha/Configuration.html" title="Mocha::Configuration (class)">Configuration</a></span> for the available options.</p>
|
161
|
-
|
162
|
-
<p>Typically the configuration is set globally in a <code>test_helper.rb</code> or <code>spec_helper.rb</code> file.</p>
|
163
|
-
|
164
|
-
|
165
|
-
</div>
|
166
|
-
</div>
|
167
|
-
<div class="tags">
|
168
|
-
|
169
|
-
<div class="examples">
|
170
|
-
<p class="tag_title">Examples:</p>
|
171
|
-
|
172
|
-
|
173
|
-
<p class="example_title"><div class='inline'>
|
174
|
-
<p>Setting multiple configuration options</p>
|
175
|
-
</div></p>
|
176
|
-
|
177
|
-
<pre class="example code"><code><span class='const'><span class='object_link'><a href="" title="Mocha (module)">Mocha</a></span></span><span class='period'>.</span><span class='id identifier rubyid_configure'>configure</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span>
|
178
|
-
<span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_stubbing_method_unnecessarily'>stubbing_method_unnecessarily</span> <span class='op'>=</span> <span class='symbol'>:prevent</span>
|
179
|
-
<span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_stubbing_method_on_non_mock_object'>stubbing_method_on_non_mock_object</span> <span class='op'>=</span> <span class='symbol'>:warn</span>
|
180
|
-
<span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_stubbing_method_on_nil'>stubbing_method_on_nil</span> <span class='op'>=</span> <span class='symbol'>:allow</span>
|
181
|
-
<span class='kw'>end</span></code></pre>
|
182
|
-
|
183
|
-
</div>
|
184
|
-
|
185
|
-
<p class="tag_title">Yield Parameters:</p>
|
186
|
-
<ul class="yieldparam">
|
187
|
-
|
188
|
-
<li>
|
189
|
-
|
190
|
-
<span class='name'>configuration</span>
|
191
|
-
|
192
|
-
|
193
|
-
<span class='type'>(<tt><span class='object_link'><a href="Mocha/Configuration.html" title="Mocha::Configuration (class)">Configuration</a></span></tt>)</span>
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
—
|
198
|
-
<div class='inline'>
|
199
|
-
<p>the configuration for modification</p>
|
200
|
-
</div>
|
201
|
-
|
202
|
-
</li>
|
203
|
-
|
204
|
-
</ul>
|
205
|
-
|
206
|
-
<p class="tag_title">See Also:</p>
|
207
|
-
<ul class="see">
|
208
|
-
|
209
|
-
<li><span class='object_link'><a href="Mocha/Configuration.html" title="Mocha::Configuration (class)">Configuration</a></span></li>
|
210
|
-
|
211
|
-
</ul>
|
212
|
-
|
213
|
-
</div><table class="source_code">
|
214
|
-
<tr>
|
215
|
-
<td>
|
216
|
-
<pre class="lines">
|
217
|
-
|
218
|
-
|
219
|
-
17
|
220
|
-
18
|
221
|
-
19</pre>
|
222
|
-
</td>
|
223
|
-
<td>
|
224
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 17</span>
|
225
|
-
|
226
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_configure'>configure</span>
|
227
|
-
<span class='kw'>yield</span> <span class='id identifier rubyid_configuration'>configuration</span>
|
228
|
-
<span class='kw'>end</span></pre>
|
229
|
-
</td>
|
230
|
-
</tr>
|
231
|
-
</table>
|
232
|
-
</div>
|
233
|
-
|
234
|
-
</div>
|
235
|
-
|
236
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-625523-7"></script>
|
237
|
-
<script>
|
238
|
-
window.dataLayer = window.dataLayer || [];
|
239
|
-
function gtag(){dataLayer.push(arguments);}
|
240
|
-
gtag('js', new Date());
|
241
|
-
|
242
|
-
gtag('config', 'UA-625523-7');
|
243
|
-
</script>
|
244
|
-
</div>
|
245
|
-
|
246
|
-
<div id="footer">
|
247
|
-
Generated on Sat Jan 4 17:36:46 2020 by
|
248
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
249
|
-
0.9.20 (ruby-2.6.5).
|
250
|
-
</div>
|
251
|
-
|
252
|
-
</div>
|
253
|
-
</body>
|
254
|
-
</html>
|