mocha 1.10.2 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (235) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.yardopts +1 -0
  4. data/CONTRIBUTING.md +1 -1
  5. data/README.md +28 -30
  6. data/RELEASE.md +87 -0
  7. data/Rakefile +7 -5
  8. data/lib/mocha/api.rb +2 -3
  9. data/lib/mocha/block_matcher.rb +31 -0
  10. data/lib/mocha/cardinality.rb +30 -27
  11. data/lib/mocha/configuration.rb +2 -2
  12. data/lib/mocha/expectation.rb +71 -30
  13. data/lib/mocha/inspect.rb +6 -4
  14. data/lib/mocha/invocation.rb +9 -5
  15. data/lib/mocha/mock.rb +41 -15
  16. data/lib/mocha/mockery.rb +17 -27
  17. data/lib/mocha/parameter_matchers.rb +1 -0
  18. data/lib/mocha/parameter_matchers/has_entries.rb +2 -3
  19. data/lib/mocha/parameter_matchers/has_entry.rb +24 -16
  20. data/lib/mocha/parameter_matchers/has_key.rb +2 -3
  21. data/lib/mocha/parameter_matchers/has_keys.rb +53 -0
  22. data/lib/mocha/parameter_matchers/has_value.rb +2 -3
  23. data/lib/mocha/parameter_matchers/is_a.rb +2 -3
  24. data/lib/mocha/parameter_matchers/not.rb +2 -3
  25. data/lib/mocha/state_machine.rb +31 -40
  26. data/lib/mocha/stubbed_method.rb +4 -6
  27. data/lib/mocha/version.rb +1 -1
  28. data/lib/mocha/yield_parameters.rb +5 -11
  29. data/mocha.gemspec +13 -7
  30. metadata +8 -210
  31. data/bin/build-matrix +0 -82
  32. data/docs/CNAME +0 -1
  33. data/docs/Mocha.html +0 -254
  34. data/docs/Mocha/API.html +0 -1287
  35. data/docs/Mocha/ClassMethods.html +0 -264
  36. data/docs/Mocha/Configuration.html +0 -1525
  37. data/docs/Mocha/Expectation.html +0 -2654
  38. data/docs/Mocha/ExpectationError.html +0 -152
  39. data/docs/Mocha/ExpectationErrorFactory.html +0 -260
  40. data/docs/Mocha/Hooks.html +0 -370
  41. data/docs/Mocha/Integration.html +0 -125
  42. data/docs/Mocha/Integration/MiniTest.html +0 -123
  43. data/docs/Mocha/Integration/MiniTest/Adapter.html +0 -164
  44. data/docs/Mocha/Integration/TestUnit.html +0 -123
  45. data/docs/Mocha/Integration/TestUnit/Adapter.html +0 -164
  46. data/docs/Mocha/Mock.html +0 -1237
  47. data/docs/Mocha/ObjectMethods.html +0 -765
  48. data/docs/Mocha/ParameterMatchers.html +0 -2961
  49. data/docs/Mocha/ParameterMatchers/AllOf.html +0 -153
  50. data/docs/Mocha/ParameterMatchers/AnyOf.html +0 -153
  51. data/docs/Mocha/ParameterMatchers/AnyParameters.html +0 -153
  52. data/docs/Mocha/ParameterMatchers/Anything.html +0 -153
  53. data/docs/Mocha/ParameterMatchers/Base.html +0 -441
  54. data/docs/Mocha/ParameterMatchers/Equals.html +0 -153
  55. data/docs/Mocha/ParameterMatchers/EquivalentUri.html +0 -153
  56. data/docs/Mocha/ParameterMatchers/HasEntries.html +0 -153
  57. data/docs/Mocha/ParameterMatchers/HasEntry.html +0 -153
  58. data/docs/Mocha/ParameterMatchers/HasKey.html +0 -153
  59. data/docs/Mocha/ParameterMatchers/HasValue.html +0 -153
  60. data/docs/Mocha/ParameterMatchers/Includes.html +0 -153
  61. data/docs/Mocha/ParameterMatchers/InstanceOf.html +0 -153
  62. data/docs/Mocha/ParameterMatchers/IsA.html +0 -153
  63. data/docs/Mocha/ParameterMatchers/KindOf.html +0 -153
  64. data/docs/Mocha/ParameterMatchers/Not.html +0 -153
  65. data/docs/Mocha/ParameterMatchers/Optionally.html +0 -153
  66. data/docs/Mocha/ParameterMatchers/RegexpMatches.html +0 -153
  67. data/docs/Mocha/ParameterMatchers/RespondsWith.html +0 -153
  68. data/docs/Mocha/ParameterMatchers/YamlEquivalent.html +0 -153
  69. data/docs/Mocha/Sequence.html +0 -149
  70. data/docs/Mocha/StateMachine.html +0 -527
  71. data/docs/Mocha/StateMachine/State.html +0 -140
  72. data/docs/Mocha/StateMachine/StatePredicate.html +0 -140
  73. data/docs/Mocha/StubbingError.html +0 -150
  74. data/docs/_index.html +0 -519
  75. data/docs/class_list.html +0 -51
  76. data/docs/css/common.css +0 -1
  77. data/docs/css/full_list.css +0 -58
  78. data/docs/css/style.css +0 -496
  79. data/docs/file.COPYING.html +0 -81
  80. data/docs/file.MIT-LICENSE.html +0 -85
  81. data/docs/file.README.html +0 -448
  82. data/docs/file.RELEASE.html +0 -974
  83. data/docs/file_list.html +0 -71
  84. data/docs/frames.html +0 -17
  85. data/docs/index.html +0 -448
  86. data/docs/js/app.js +0 -303
  87. data/docs/js/full_list.js +0 -216
  88. data/docs/js/jquery.js +0 -4
  89. data/docs/method_list.html +0 -635
  90. data/docs/top-level-namespace.html +0 -118
  91. data/gemfiles/Gemfile.minitest.1.3.0 +0 -7
  92. data/gemfiles/Gemfile.minitest.1.4.0 +0 -7
  93. data/gemfiles/Gemfile.minitest.1.4.1 +0 -7
  94. data/gemfiles/Gemfile.minitest.1.4.2 +0 -7
  95. data/gemfiles/Gemfile.minitest.2.0.0 +0 -7
  96. data/gemfiles/Gemfile.minitest.2.0.1 +0 -7
  97. data/gemfiles/Gemfile.minitest.2.11.0 +0 -7
  98. data/gemfiles/Gemfile.minitest.2.11.2 +0 -7
  99. data/gemfiles/Gemfile.minitest.2.3.0 +0 -7
  100. data/gemfiles/Gemfile.minitest.5.11.3 +0 -7
  101. data/gemfiles/Gemfile.test-unit.2.0.0 +0 -7
  102. data/gemfiles/Gemfile.test-unit.2.0.1 +0 -7
  103. data/gemfiles/Gemfile.test-unit.2.0.3 +0 -7
  104. data/lib/mocha/multiple_yields.rb +0 -15
  105. data/lib/mocha/no_yields.rb +0 -5
  106. data/lib/mocha/pretty_parameters.rb +0 -24
  107. data/lib/mocha/single_yield.rb +0 -13
  108. data/test/acceptance/acceptance_test_helper.rb +0 -41
  109. data/test/acceptance/bug_18914_test.rb +0 -37
  110. data/test/acceptance/bug_21465_test.rb +0 -31
  111. data/test/acceptance/bug_21563_test.rb +0 -22
  112. data/test/acceptance/display_matching_invocations_alongside_expectations_test.rb +0 -69
  113. data/test/acceptance/exception_rescue_test.rb +0 -53
  114. data/test/acceptance/expectations_on_multiple_methods_test.rb +0 -55
  115. data/test/acceptance/expected_invocation_count_test.rb +0 -229
  116. data/test/acceptance/failure_messages_test.rb +0 -61
  117. data/test/acceptance/issue_272_test.rb +0 -50
  118. data/test/acceptance/issue_65_test.rb +0 -64
  119. data/test/acceptance/issue_70_test.rb +0 -53
  120. data/test/acceptance/mocha_example_test.rb +0 -96
  121. data/test/acceptance/mocha_test_result_test.rb +0 -83
  122. data/test/acceptance/mock_built_with_first_argument_type_being_string_test.rb +0 -99
  123. data/test/acceptance/mock_test.rb +0 -139
  124. data/test/acceptance/mocked_methods_dispatch_test.rb +0 -75
  125. data/test/acceptance/multiple_expectations_failure_message_test.rb +0 -66
  126. data/test/acceptance/optional_parameters_test.rb +0 -67
  127. data/test/acceptance/parameter_matcher_test.rb +0 -299
  128. data/test/acceptance/partial_mocks_test.rb +0 -44
  129. data/test/acceptance/prepend_test.rb +0 -86
  130. data/test/acceptance/prevent_use_of_mocha_outside_test_test.rb +0 -76
  131. data/test/acceptance/raise_exception_test.rb +0 -36
  132. data/test/acceptance/return_value_test.rb +0 -49
  133. data/test/acceptance/sequence_test.rb +0 -189
  134. data/test/acceptance/states_test.rb +0 -71
  135. data/test/acceptance/stub_any_instance_method_defined_on_superclass_test.rb +0 -64
  136. data/test/acceptance/stub_any_instance_method_test.rb +0 -301
  137. data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +0 -105
  138. data/test/acceptance/stub_class_method_defined_on_class_test.rb +0 -78
  139. data/test/acceptance/stub_class_method_defined_on_module_test.rb +0 -73
  140. data/test/acceptance/stub_class_method_defined_on_superclass_test.rb +0 -144
  141. data/test/acceptance/stub_everything_test.rb +0 -53
  142. data/test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb +0 -91
  143. data/test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb +0 -67
  144. data/test/acceptance/stub_instance_method_defined_on_class_test.rb +0 -67
  145. data/test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb +0 -136
  146. data/test/acceptance/stub_instance_method_defined_on_module_test.rb +0 -76
  147. data/test/acceptance/stub_instance_method_defined_on_object_class_test.rb +0 -75
  148. data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +0 -67
  149. data/test/acceptance/stub_instance_method_defined_on_superclass_test.rb +0 -70
  150. data/test/acceptance/stub_method_defined_on_module_and_aliased_test.rb +0 -38
  151. data/test/acceptance/stub_module_method_test.rb +0 -200
  152. data/test/acceptance/stub_test.rb +0 -49
  153. data/test/acceptance/stubba_example_test.rb +0 -93
  154. data/test/acceptance/stubba_test_result_test.rb +0 -71
  155. data/test/acceptance/stubbing_error_backtrace_test.rb +0 -63
  156. data/test/acceptance/stubbing_frozen_object_test.rb +0 -88
  157. data/test/acceptance/stubbing_method_accepting_block_parameter_test.rb +0 -52
  158. data/test/acceptance/stubbing_method_unnecessarily_test.rb +0 -63
  159. data/test/acceptance/stubbing_nil_test.rb +0 -60
  160. data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +0 -157
  161. data/test/acceptance/stubbing_non_existent_class_method_test.rb +0 -157
  162. data/test/acceptance/stubbing_non_existent_instance_method_test.rb +0 -145
  163. data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +0 -128
  164. data/test/acceptance/stubbing_non_public_class_method_test.rb +0 -163
  165. data/test/acceptance/stubbing_non_public_instance_method_test.rb +0 -141
  166. data/test/acceptance/stubbing_on_non_mock_object_test.rb +0 -70
  167. data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +0 -33
  168. data/test/acceptance/throw_test.rb +0 -42
  169. data/test/acceptance/unexpected_invocation_test.rb +0 -23
  170. data/test/acceptance/unstubbing_test.rb +0 -194
  171. data/test/assertions.rb +0 -8
  172. data/test/deprecation_disabler.rb +0 -15
  173. data/test/execution_point.rb +0 -36
  174. data/test/integration/mini_test_test.rb +0 -8
  175. data/test/integration/shared_tests.rb +0 -178
  176. data/test/integration/test_unit_test.rb +0 -8
  177. data/test/method_definer.rb +0 -16
  178. data/test/mini_test_result.rb +0 -96
  179. data/test/minitest_result.rb +0 -48
  180. data/test/simple_counter.rb +0 -11
  181. data/test/test_helper.rb +0 -58
  182. data/test/test_runner.rb +0 -58
  183. data/test/test_unit_result.rb +0 -22
  184. data/test/unit/any_instance_method_test.rb +0 -175
  185. data/test/unit/array_inspect_test.rb +0 -14
  186. data/test/unit/backtrace_filter_test.rb +0 -17
  187. data/test/unit/cardinality_test.rb +0 -72
  188. data/test/unit/central_test.rb +0 -98
  189. data/test/unit/change_state_side_effect_test.rb +0 -37
  190. data/test/unit/class_methods_test.rb +0 -69
  191. data/test/unit/configuration_test.rb +0 -37
  192. data/test/unit/date_time_inspect_test.rb +0 -19
  193. data/test/unit/exception_raiser_test.rb +0 -45
  194. data/test/unit/expectation_list_test.rb +0 -82
  195. data/test/unit/expectation_test.rb +0 -492
  196. data/test/unit/hash_inspect_test.rb +0 -14
  197. data/test/unit/hooks_test.rb +0 -35
  198. data/test/unit/in_state_ordering_constraint_test.rb +0 -39
  199. data/test/unit/instance_method_test.rb +0 -282
  200. data/test/unit/method_matcher_test.rb +0 -26
  201. data/test/unit/mock_test.rb +0 -372
  202. data/test/unit/mockery_test.rb +0 -171
  203. data/test/unit/module_methods_test.rb +0 -16
  204. data/test/unit/multiple_yields_test.rb +0 -16
  205. data/test/unit/no_yields_test.rb +0 -16
  206. data/test/unit/object_inspect_test.rb +0 -60
  207. data/test/unit/object_methods_test.rb +0 -63
  208. data/test/unit/parameter_matchers/all_of_test.rb +0 -24
  209. data/test/unit/parameter_matchers/any_of_test.rb +0 -24
  210. data/test/unit/parameter_matchers/anything_test.rb +0 -19
  211. data/test/unit/parameter_matchers/equals_test.rb +0 -23
  212. data/test/unit/parameter_matchers/equivalent_uri_test.rb +0 -41
  213. data/test/unit/parameter_matchers/has_entries_test.rb +0 -51
  214. data/test/unit/parameter_matchers/has_entry_test.rb +0 -128
  215. data/test/unit/parameter_matchers/has_key_test.rb +0 -54
  216. data/test/unit/parameter_matchers/has_value_test.rb +0 -55
  217. data/test/unit/parameter_matchers/includes_test.rb +0 -106
  218. data/test/unit/parameter_matchers/instance_of_test.rb +0 -23
  219. data/test/unit/parameter_matchers/is_a_test.rb +0 -23
  220. data/test/unit/parameter_matchers/kind_of_test.rb +0 -23
  221. data/test/unit/parameter_matchers/not_test.rb +0 -24
  222. data/test/unit/parameter_matchers/regexp_matches_test.rb +0 -45
  223. data/test/unit/parameter_matchers/responds_with_test.rb +0 -38
  224. data/test/unit/parameter_matchers/stub_matcher.rb +0 -23
  225. data/test/unit/parameter_matchers/yaml_equivalent_test.rb +0 -23
  226. data/test/unit/parameters_matcher_test.rb +0 -119
  227. data/test/unit/receivers_test.rb +0 -96
  228. data/test/unit/return_values_test.rb +0 -66
  229. data/test/unit/sequence_test.rb +0 -100
  230. data/test/unit/single_return_value_test.rb +0 -17
  231. data/test/unit/single_yield_test.rb +0 -16
  232. data/test/unit/state_machine_test.rb +0 -96
  233. data/test/unit/string_inspect_test.rb +0 -9
  234. data/test/unit/thrower_test.rb +0 -23
  235. data/test/unit/yield_parameters_test.rb +0 -91
@@ -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 a mechanism to change the state of a {StateMachine} at some point in the future.
6
- class State
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
- end
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 == @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} is #{@state.mocha_inspect}"
22
+ "#{@state_machine.name} #{@description} #{@state.mocha_inspect}"
26
23
  end
27
24
  end
28
25
 
29
- # Provides the ability to determine whether a {StateMachine} is in a specified state at some point in the future.
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 mocha_inspect
44
- "#{@state_machine.name} is not #{@state.mocha_inspect}"
29
+ def activate
30
+ @state_machine.current_state = @state
45
31
  end
46
32
  end
47
33
 
@@ -73,30 +59,35 @@ module Mocha
73
59
  @current_state = next_state_name
74
60
  end
75
61
 
76
- # Provides a mechanism to change the {StateMachine} into the state specified by +state_name+ at some point in the future.
62
+ # Provides mechanisms to (a) determine whether the {StateMachine} is in a given state; or (b) to change the {StateMachine} into the given state.
77
63
  #
78
- # Or provides a mechanism to determine whether the {StateMachine} is in the state specified by +state_name+ at some point in the future.
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.
79
66
  #
80
- # @param [String] state_name name of new state
81
- # @return [State] state which, when activated, will change the {StateMachine} into the state with the specified +state_name+.
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+
71
+ #
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 +state_name+ at some point in the future.
87
- # rubocop:disable Naming/PredicateName
88
- def is_not(state_name)
89
- StatePredicate.new(self, state_name)
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.
81
+ #
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
- # rubocop:enable Naming/PredicateName
92
87
 
93
88
  # @private
94
89
  def mocha_inspect
95
- if @current_state
96
- "#{@name} is #{@current_state.mocha_inspect}"
97
- else
98
- "#{@name} has no current state"
99
- end
90
+ %(#{@name} #{@current_state ? "is #{@current_state.mocha_inspect}" : 'has no current state'})
100
91
  end
101
92
  end
102
93
  end
@@ -74,7 +74,7 @@ module Mocha
74
74
  def restore_original_method
75
75
  return if use_prepended_module_for_stub_method?
76
76
  if stub_method_overwrites_original_method?
77
- original_method_owner.send(:define_method, method_name, method_body(original_method))
77
+ original_method_owner.send(:define_method, method_name, method_body(@original_method))
78
78
  end
79
79
  retain_original_visibility(original_method_owner)
80
80
  end
@@ -93,18 +93,16 @@ module Mocha
93
93
  private
94
94
 
95
95
  def retain_original_visibility(method_owner)
96
- return unless original_visibility
97
- Module.instance_method(original_visibility).bind(method_owner).call(method_name)
96
+ return unless @original_visibility
97
+ Module.instance_method(@original_visibility).bind(method_owner).call(method_name)
98
98
  end
99
99
 
100
- attr_reader :original_method, :original_visibility
101
-
102
100
  def store_original_method_visibility
103
101
  @original_visibility = original_method_owner.__method_visibility__(method_name)
104
102
  end
105
103
 
106
104
  def stub_method_overwrites_original_method?
107
- original_method && original_method.owner == original_method_owner
105
+ @original_method && @original_method.owner == original_method_owner
108
106
  end
109
107
 
110
108
  def remove_original_method_from_stubbee
data/lib/mocha/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mocha
2
- VERSION = '1.10.2'.freeze
2
+ VERSION = '1.13.0'.freeze
3
3
  end
@@ -1,7 +1,3 @@
1
- require 'mocha/no_yields'
2
- require 'mocha/single_yield'
3
- require 'mocha/multiple_yields'
4
-
5
1
  module Mocha
6
2
  class YieldParameters
7
3
  def initialize
@@ -10,18 +6,16 @@ module Mocha
10
6
 
11
7
  def next_invocation
12
8
  case @parameter_groups.length
13
- when 0 then NoYields.new
9
+ when 0 then []
14
10
  when 1 then @parameter_groups.first
15
11
  else @parameter_groups.shift
16
12
  end
17
13
  end
18
14
 
19
- def add(*parameters)
20
- @parameter_groups << SingleYield.new(*parameters)
21
- end
22
-
23
- def multiple_add(*parameter_groups)
24
- @parameter_groups << MultipleYields.new(*parameter_groups)
15
+ def add(*parameter_groups)
16
+ @parameter_groups << parameter_groups.map do |pg|
17
+ pg.is_a?(Array) ? pg : [pg]
18
+ end
25
19
  end
26
20
  end
27
21
  end
data/mocha.gemspec CHANGED
@@ -12,8 +12,10 @@ 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 = `git ls-files`.split("\n")
16
- s.files.delete('.travis.yml')
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
18
+ s.files.delete('.circleci/config.yml')
17
19
  s.files.delete('.gitignore')
18
20
 
19
21
  s.homepage = 'https://mocha.jamesmead.org'
@@ -28,18 +30,22 @@ Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength
28
30
  end
29
31
  end
30
32
 
31
- if RUBY_VERSION >= '1.9.3'
32
- s.add_development_dependency('rake')
33
+ if RUBY_VERSION < '1.9.3'
34
+ s.add_development_dependency 'rake', '~> 10.0'
35
+ elsif RUBY_VERSION < '2'
36
+ s.add_development_dependency 'rake', '~> 12.2.1'
37
+ elsif RUBY_VERSION < '2.2'
38
+ s.add_development_dependency 'rake', '~> 12.3.3'
33
39
  else
34
- # Rake >= v11 does not support Ruby < v1.9.3 so use
35
- s.add_development_dependency('rake', '~> 10.0')
40
+ s.add_development_dependency 'rake'
36
41
  end
42
+
37
43
  s.add_development_dependency('introspection', '~> 0.0.1')
38
44
  if RUBY_VERSION >= '2.2.0'
39
45
  # No test libraries in standard library
40
46
  s.add_development_dependency('minitest')
41
47
  end
42
- if RUBY_VERSION >= '1.9.2'
48
+ if RUBY_VERSION >= '2.2.0'
43
49
  s.add_development_dependency('rubocop', '<= 0.58.2')
44
50
  end
45
51
  if ENV['MOCHA_GENERATE_DOCS']
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.10.2
4
+ version: 1.13.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: 2019-12-12 00:00:00.000000000 Z
11
+ date: 2021-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -74,6 +74,7 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - ".gemtest"
77
+ - ".github/FUNDING.yml"
77
78
  - ".rubocop.yml"
78
79
  - ".rubocop_todo.yml"
79
80
  - ".yardopts"
@@ -84,80 +85,7 @@ files:
84
85
  - README.md
85
86
  - RELEASE.md
86
87
  - Rakefile
87
- - bin/build-matrix
88
- - docs/CNAME
89
- - docs/Mocha.html
90
- - docs/Mocha/API.html
91
- - docs/Mocha/ClassMethods.html
92
- - docs/Mocha/Configuration.html
93
- - docs/Mocha/Expectation.html
94
- - docs/Mocha/ExpectationError.html
95
- - docs/Mocha/ExpectationErrorFactory.html
96
- - docs/Mocha/Hooks.html
97
- - docs/Mocha/Integration.html
98
- - docs/Mocha/Integration/MiniTest.html
99
- - docs/Mocha/Integration/MiniTest/Adapter.html
100
- - docs/Mocha/Integration/TestUnit.html
101
- - docs/Mocha/Integration/TestUnit/Adapter.html
102
- - docs/Mocha/Mock.html
103
- - docs/Mocha/ObjectMethods.html
104
- - docs/Mocha/ParameterMatchers.html
105
- - docs/Mocha/ParameterMatchers/AllOf.html
106
- - docs/Mocha/ParameterMatchers/AnyOf.html
107
- - docs/Mocha/ParameterMatchers/AnyParameters.html
108
- - docs/Mocha/ParameterMatchers/Anything.html
109
- - docs/Mocha/ParameterMatchers/Base.html
110
- - docs/Mocha/ParameterMatchers/Equals.html
111
- - docs/Mocha/ParameterMatchers/EquivalentUri.html
112
- - docs/Mocha/ParameterMatchers/HasEntries.html
113
- - docs/Mocha/ParameterMatchers/HasEntry.html
114
- - docs/Mocha/ParameterMatchers/HasKey.html
115
- - docs/Mocha/ParameterMatchers/HasValue.html
116
- - docs/Mocha/ParameterMatchers/Includes.html
117
- - docs/Mocha/ParameterMatchers/InstanceOf.html
118
- - docs/Mocha/ParameterMatchers/IsA.html
119
- - docs/Mocha/ParameterMatchers/KindOf.html
120
- - docs/Mocha/ParameterMatchers/Not.html
121
- - docs/Mocha/ParameterMatchers/Optionally.html
122
- - docs/Mocha/ParameterMatchers/RegexpMatches.html
123
- - docs/Mocha/ParameterMatchers/RespondsWith.html
124
- - docs/Mocha/ParameterMatchers/YamlEquivalent.html
125
- - docs/Mocha/Sequence.html
126
- - docs/Mocha/StateMachine.html
127
- - docs/Mocha/StateMachine/State.html
128
- - docs/Mocha/StateMachine/StatePredicate.html
129
- - docs/Mocha/StubbingError.html
130
- - docs/_index.html
131
- - docs/class_list.html
132
- - docs/css/common.css
133
- - docs/css/full_list.css
134
- - docs/css/style.css
135
- - docs/file.COPYING.html
136
- - docs/file.MIT-LICENSE.html
137
- - docs/file.README.html
138
- - docs/file.RELEASE.html
139
- - docs/file_list.html
140
- - docs/frames.html
141
- - docs/index.html
142
- - docs/js/app.js
143
- - docs/js/full_list.js
144
- - docs/js/jquery.js
145
- - docs/method_list.html
146
- - docs/top-level-namespace.html
147
- - gemfiles/Gemfile.minitest.1.3.0
148
- - gemfiles/Gemfile.minitest.1.4.0
149
- - gemfiles/Gemfile.minitest.1.4.1
150
- - gemfiles/Gemfile.minitest.1.4.2
151
- - gemfiles/Gemfile.minitest.2.0.0
152
- - gemfiles/Gemfile.minitest.2.0.1
153
- - gemfiles/Gemfile.minitest.2.11.0
154
- - gemfiles/Gemfile.minitest.2.11.2
155
- - gemfiles/Gemfile.minitest.2.3.0
156
- - gemfiles/Gemfile.minitest.5.11.3
157
88
  - gemfiles/Gemfile.minitest.latest
158
- - gemfiles/Gemfile.test-unit.2.0.0
159
- - gemfiles/Gemfile.test-unit.2.0.1
160
- - gemfiles/Gemfile.test-unit.2.0.3
161
89
  - gemfiles/Gemfile.test-unit.latest
162
90
  - init.rb
163
91
  - lib/mocha.rb
@@ -165,6 +93,7 @@ files:
165
93
  - lib/mocha/api.rb
166
94
  - lib/mocha/argument_iterator.rb
167
95
  - lib/mocha/backtrace_filter.rb
96
+ - lib/mocha/block_matcher.rb
168
97
  - lib/mocha/cardinality.rb
169
98
  - lib/mocha/central.rb
170
99
  - lib/mocha/change_state_side_effect.rb
@@ -217,9 +146,7 @@ files:
217
146
  - lib/mocha/minitest.rb
218
147
  - lib/mocha/mock.rb
219
148
  - lib/mocha/mockery.rb
220
- - lib/mocha/multiple_yields.rb
221
149
  - lib/mocha/names.rb
222
- - lib/mocha/no_yields.rb
223
150
  - lib/mocha/not_initialized_error.rb
224
151
  - lib/mocha/object_methods.rb
225
152
  - lib/mocha/parameter_matchers.rb
@@ -233,6 +160,7 @@ files:
233
160
  - lib/mocha/parameter_matchers/has_entries.rb
234
161
  - lib/mocha/parameter_matchers/has_entry.rb
235
162
  - lib/mocha/parameter_matchers/has_key.rb
163
+ - lib/mocha/parameter_matchers/has_keys.rb
236
164
  - lib/mocha/parameter_matchers/has_value.rb
237
165
  - lib/mocha/parameter_matchers/includes.rb
238
166
  - lib/mocha/parameter_matchers/instance_methods.rb
@@ -245,7 +173,6 @@ files:
245
173
  - lib/mocha/parameter_matchers/responds_with.rb
246
174
  - lib/mocha/parameter_matchers/yaml_equivalent.rb
247
175
  - lib/mocha/parameters_matcher.rb
248
- - lib/mocha/pretty_parameters.rb
249
176
  - lib/mocha/raised_exception.rb
250
177
  - lib/mocha/receivers.rb
251
178
  - lib/mocha/return_values.rb
@@ -253,7 +180,6 @@ files:
253
180
  - lib/mocha/sequence.rb
254
181
  - lib/mocha/setup.rb
255
182
  - lib/mocha/single_return_value.rb
256
- - lib/mocha/single_yield.rb
257
183
  - lib/mocha/singleton_class.rb
258
184
  - lib/mocha/state_machine.rb
259
185
  - lib/mocha/stubbed_method.rb
@@ -264,134 +190,6 @@ files:
264
190
  - lib/mocha/version.rb
265
191
  - lib/mocha/yield_parameters.rb
266
192
  - mocha.gemspec
267
- - test/acceptance/acceptance_test_helper.rb
268
- - test/acceptance/bug_18914_test.rb
269
- - test/acceptance/bug_21465_test.rb
270
- - test/acceptance/bug_21563_test.rb
271
- - test/acceptance/display_matching_invocations_alongside_expectations_test.rb
272
- - test/acceptance/exception_rescue_test.rb
273
- - test/acceptance/expectations_on_multiple_methods_test.rb
274
- - test/acceptance/expected_invocation_count_test.rb
275
- - test/acceptance/failure_messages_test.rb
276
- - test/acceptance/issue_272_test.rb
277
- - test/acceptance/issue_65_test.rb
278
- - test/acceptance/issue_70_test.rb
279
- - test/acceptance/mocha_example_test.rb
280
- - test/acceptance/mocha_test_result_test.rb
281
- - test/acceptance/mock_built_with_first_argument_type_being_string_test.rb
282
- - test/acceptance/mock_test.rb
283
- - test/acceptance/mocked_methods_dispatch_test.rb
284
- - test/acceptance/multiple_expectations_failure_message_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/assertions.rb
331
- - test/deprecation_disabler.rb
332
- - test/execution_point.rb
333
- - test/integration/mini_test_test.rb
334
- - test/integration/shared_tests.rb
335
- - test/integration/test_unit_test.rb
336
- - test/method_definer.rb
337
- - test/mini_test_result.rb
338
- - test/minitest_result.rb
339
- - test/simple_counter.rb
340
- - test/test_helper.rb
341
- - test/test_runner.rb
342
- - test/test_unit_result.rb
343
- - test/unit/any_instance_method_test.rb
344
- - test/unit/array_inspect_test.rb
345
- - test/unit/backtrace_filter_test.rb
346
- - test/unit/cardinality_test.rb
347
- - test/unit/central_test.rb
348
- - test/unit/change_state_side_effect_test.rb
349
- - test/unit/class_methods_test.rb
350
- - test/unit/configuration_test.rb
351
- - test/unit/date_time_inspect_test.rb
352
- - test/unit/exception_raiser_test.rb
353
- - test/unit/expectation_list_test.rb
354
- - test/unit/expectation_test.rb
355
- - test/unit/hash_inspect_test.rb
356
- - test/unit/hooks_test.rb
357
- - test/unit/in_state_ordering_constraint_test.rb
358
- - test/unit/instance_method_test.rb
359
- - test/unit/method_matcher_test.rb
360
- - test/unit/mock_test.rb
361
- - test/unit/mockery_test.rb
362
- - test/unit/module_methods_test.rb
363
- - test/unit/multiple_yields_test.rb
364
- - test/unit/no_yields_test.rb
365
- - test/unit/object_inspect_test.rb
366
- - test/unit/object_methods_test.rb
367
- - test/unit/parameter_matchers/all_of_test.rb
368
- - test/unit/parameter_matchers/any_of_test.rb
369
- - test/unit/parameter_matchers/anything_test.rb
370
- - test/unit/parameter_matchers/equals_test.rb
371
- - test/unit/parameter_matchers/equivalent_uri_test.rb
372
- - test/unit/parameter_matchers/has_entries_test.rb
373
- - test/unit/parameter_matchers/has_entry_test.rb
374
- - test/unit/parameter_matchers/has_key_test.rb
375
- - test/unit/parameter_matchers/has_value_test.rb
376
- - test/unit/parameter_matchers/includes_test.rb
377
- - test/unit/parameter_matchers/instance_of_test.rb
378
- - test/unit/parameter_matchers/is_a_test.rb
379
- - test/unit/parameter_matchers/kind_of_test.rb
380
- - test/unit/parameter_matchers/not_test.rb
381
- - test/unit/parameter_matchers/regexp_matches_test.rb
382
- - test/unit/parameter_matchers/responds_with_test.rb
383
- - test/unit/parameter_matchers/stub_matcher.rb
384
- - test/unit/parameter_matchers/yaml_equivalent_test.rb
385
- - test/unit/parameters_matcher_test.rb
386
- - test/unit/receivers_test.rb
387
- - test/unit/return_values_test.rb
388
- - test/unit/sequence_test.rb
389
- - test/unit/single_return_value_test.rb
390
- - test/unit/single_yield_test.rb
391
- - test/unit/state_machine_test.rb
392
- - test/unit/string_inspect_test.rb
393
- - test/unit/thrower_test.rb
394
- - test/unit/yield_parameters_test.rb
395
193
  - yard-templates/default/layout/html/google_analytics.erb
396
194
  - yard-templates/default/layout/html/setup.rb
397
195
  homepage: https://mocha.jamesmead.org
@@ -399,7 +197,7 @@ licenses:
399
197
  - MIT
400
198
  - BSD-2-Clause
401
199
  metadata: {}
402
- post_install_message:
200
+ post_install_message:
403
201
  rdoc_options: []
404
202
  require_paths:
405
203
  - lib
@@ -415,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
415
213
  version: '0'
416
214
  requirements: []
417
215
  rubygems_version: 3.0.3
418
- signing_key:
216
+ signing_key:
419
217
  specification_version: 4
420
218
  summary: Mocking and stubbing library
421
219
  test_files: []