mocha 1.1.0 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. checksums.yaml +5 -5
  2. data/.github/FUNDING.yml +1 -0
  3. data/.rubocop.yml +61 -0
  4. data/.rubocop_todo.yml +27 -0
  5. data/.yardopts +1 -0
  6. data/CONTRIBUTING.md +4 -9
  7. data/README.md +114 -28
  8. data/RELEASE.md +248 -1
  9. data/Rakefile +53 -35
  10. data/gemfiles/Gemfile.test-unit.latest +5 -1
  11. data/init.rb +1 -3
  12. data/lib/mocha/any_instance_method.rb +12 -72
  13. data/lib/mocha/api.rb +121 -56
  14. data/lib/mocha/argument_iterator.rb +4 -8
  15. data/lib/mocha/backtrace_filter.rb +1 -5
  16. data/lib/mocha/block_matcher.rb +31 -0
  17. data/lib/mocha/cardinality.rb +60 -49
  18. data/lib/mocha/central.rb +21 -12
  19. data/lib/mocha/change_state_side_effect.rb +0 -4
  20. data/lib/mocha/class_methods.rb +19 -20
  21. data/lib/mocha/configuration.rb +361 -18
  22. data/lib/mocha/debug.rb +3 -2
  23. data/lib/mocha/deprecation.rb +8 -11
  24. data/lib/mocha/detection/mini_test.rb +0 -2
  25. data/lib/mocha/detection/test_unit.rb +3 -5
  26. data/lib/mocha/error_with_filtered_backtrace.rb +13 -0
  27. data/lib/mocha/exception_raiser.rb +4 -6
  28. data/lib/mocha/expectation.rb +125 -89
  29. data/lib/mocha/expectation_error.rb +1 -1
  30. data/lib/mocha/expectation_error_factory.rb +0 -1
  31. data/lib/mocha/expectation_list.rb +7 -11
  32. data/lib/mocha/hooks.rb +1 -3
  33. data/lib/mocha/in_state_ordering_constraint.rb +0 -4
  34. data/lib/mocha/inspect.rb +30 -38
  35. data/lib/mocha/instance_method.rb +15 -8
  36. data/lib/mocha/integration/mini_test/adapter.rb +2 -4
  37. data/lib/mocha/integration/mini_test/exception_translation.rb +1 -1
  38. data/lib/mocha/integration/mini_test/nothing.rb +4 -4
  39. data/lib/mocha/integration/mini_test/version_13.rb +4 -1
  40. data/lib/mocha/integration/mini_test/version_140.rb +4 -1
  41. data/lib/mocha/integration/mini_test/version_141.rb +4 -1
  42. data/lib/mocha/integration/mini_test/version_142_to_172.rb +4 -1
  43. data/lib/mocha/integration/mini_test/version_200.rb +4 -1
  44. data/lib/mocha/integration/mini_test/version_201_to_222.rb +4 -1
  45. data/lib/mocha/integration/mini_test/version_2110_to_2111.rb +4 -1
  46. data/lib/mocha/integration/mini_test/version_2112_to_320.rb +4 -1
  47. data/lib/mocha/integration/mini_test/version_230_to_2101.rb +4 -1
  48. data/lib/mocha/integration/mini_test.rb +7 -0
  49. data/lib/mocha/integration/monkey_patcher.rb +8 -2
  50. data/lib/mocha/integration/test_unit/adapter.rb +5 -6
  51. data/lib/mocha/integration/test_unit/gem_version_200.rb +5 -2
  52. data/lib/mocha/integration/test_unit/gem_version_201_to_202.rb +5 -2
  53. data/lib/mocha/integration/test_unit/gem_version_203_to_220.rb +5 -2
  54. data/lib/mocha/integration/test_unit/gem_version_230_to_250.rb +5 -2
  55. data/lib/mocha/integration/test_unit/nothing.rb +4 -4
  56. data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +4 -1
  57. data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +4 -1
  58. data/lib/mocha/integration/test_unit.rb +7 -0
  59. data/lib/mocha/integration.rb +2 -5
  60. data/lib/mocha/invocation.rb +77 -0
  61. data/lib/mocha/is_a.rb +0 -2
  62. data/lib/mocha/logger.rb +0 -4
  63. data/lib/mocha/macos_version.rb +5 -0
  64. data/lib/mocha/method_matcher.rb +1 -5
  65. data/lib/mocha/minitest.rb +8 -0
  66. data/lib/mocha/mock.rb +94 -46
  67. data/lib/mocha/mockery.rb +72 -98
  68. data/lib/mocha/names.rb +2 -12
  69. data/lib/mocha/not_initialized_error.rb +7 -0
  70. data/lib/mocha/object_methods.rb +25 -31
  71. data/lib/mocha/parameter_matchers/all_of.rb +2 -8
  72. data/lib/mocha/parameter_matchers/any_of.rb +2 -8
  73. data/lib/mocha/parameter_matchers/any_parameters.rb +3 -9
  74. data/lib/mocha/parameter_matchers/anything.rb +2 -8
  75. data/lib/mocha/parameter_matchers/base.rb +6 -12
  76. data/lib/mocha/parameter_matchers/equals.rb +1 -7
  77. data/lib/mocha/parameter_matchers/{query_string.rb → equivalent_uri.rb} +15 -15
  78. data/lib/mocha/parameter_matchers/has_entries.rb +2 -7
  79. data/lib/mocha/parameter_matchers/has_entry.rb +26 -21
  80. data/lib/mocha/parameter_matchers/has_key.rb +2 -7
  81. data/lib/mocha/parameter_matchers/has_keys.rb +53 -0
  82. data/lib/mocha/parameter_matchers/has_value.rb +2 -7
  83. data/lib/mocha/parameter_matchers/includes.rb +50 -8
  84. data/lib/mocha/parameter_matchers/instance_methods.rb +18 -0
  85. data/lib/mocha/parameter_matchers/instance_of.rb +0 -6
  86. data/lib/mocha/parameter_matchers/is_a.rb +2 -7
  87. data/lib/mocha/parameter_matchers/kind_of.rb +2 -6
  88. data/lib/mocha/parameter_matchers/not.rb +2 -7
  89. data/lib/mocha/parameter_matchers/optionally.rb +4 -10
  90. data/lib/mocha/parameter_matchers/regexp_matches.rb +0 -6
  91. data/lib/mocha/parameter_matchers/responds_with.rb +3 -8
  92. data/lib/mocha/parameter_matchers/yaml_equivalent.rb +2 -6
  93. data/lib/mocha/parameter_matchers.rb +3 -4
  94. data/lib/mocha/parameters_matcher.rb +6 -9
  95. data/lib/mocha/raised_exception.rb +11 -0
  96. data/lib/mocha/receivers.rb +10 -14
  97. data/lib/mocha/return_values.rb +4 -8
  98. data/lib/mocha/ruby_version.rb +4 -0
  99. data/lib/mocha/sequence.rb +4 -9
  100. data/lib/mocha/setup.rb +5 -0
  101. data/lib/mocha/single_return_value.rb +2 -5
  102. data/lib/mocha/singleton_class.rb +9 -0
  103. data/lib/mocha/state_machine.rb +33 -46
  104. data/lib/mocha/stubbed_method.rb +125 -0
  105. data/lib/mocha/stubbing_error.rb +2 -13
  106. data/lib/mocha/test_unit.rb +7 -2
  107. data/lib/mocha/thrower.rb +4 -6
  108. data/lib/mocha/thrown_object.rb +12 -0
  109. data/lib/mocha/version.rb +1 -1
  110. data/lib/mocha/yield_parameters.rb +7 -17
  111. data/lib/mocha.rb +8 -0
  112. data/mocha.gemspec +42 -40
  113. data/yard-templates/default/layout/html/google_analytics.erb +6 -9
  114. data/yard-templates/default/layout/html/setup.rb +2 -3
  115. metadata +45 -191
  116. data/bin/build-matrix +0 -71
  117. data/gemfiles/Gemfile.minitest.1.3.0 +0 -7
  118. data/gemfiles/Gemfile.minitest.1.4.0 +0 -7
  119. data/gemfiles/Gemfile.minitest.1.4.1 +0 -7
  120. data/gemfiles/Gemfile.minitest.1.4.2 +0 -7
  121. data/gemfiles/Gemfile.minitest.2.0.0 +0 -7
  122. data/gemfiles/Gemfile.minitest.2.0.1 +0 -7
  123. data/gemfiles/Gemfile.minitest.2.11.0 +0 -7
  124. data/gemfiles/Gemfile.minitest.2.11.2 +0 -7
  125. data/gemfiles/Gemfile.minitest.2.3.0 +0 -7
  126. data/gemfiles/Gemfile.test-unit.2.0.0 +0 -7
  127. data/gemfiles/Gemfile.test-unit.2.0.1 +0 -7
  128. data/gemfiles/Gemfile.test-unit.2.0.3 +0 -7
  129. data/lib/mocha/class_method.rb +0 -127
  130. data/lib/mocha/mini_test.rb +0 -3
  131. data/lib/mocha/module_method.rb +0 -16
  132. data/lib/mocha/module_methods.rb +0 -14
  133. data/lib/mocha/multiple_yields.rb +0 -20
  134. data/lib/mocha/no_yields.rb +0 -11
  135. data/lib/mocha/parameter_matchers/object.rb +0 -17
  136. data/lib/mocha/pretty_parameters.rb +0 -28
  137. data/lib/mocha/single_yield.rb +0 -18
  138. data/lib/mocha/standalone.rb +0 -4
  139. data/lib/mocha/unexpected_invocation.rb +0 -26
  140. data/lib/mocha_standalone.rb +0 -4
  141. data/test/acceptance/acceptance_test_helper.rb +0 -41
  142. data/test/acceptance/bug_18914_test.rb +0 -43
  143. data/test/acceptance/bug_21465_test.rb +0 -34
  144. data/test/acceptance/bug_21563_test.rb +0 -25
  145. data/test/acceptance/exception_rescue_test.rb +0 -55
  146. data/test/acceptance/expectations_on_multiple_methods_test.rb +0 -55
  147. data/test/acceptance/expected_invocation_count_test.rb +0 -232
  148. data/test/acceptance/failure_messages_test.rb +0 -64
  149. data/test/acceptance/issue_65_test.rb +0 -63
  150. data/test/acceptance/issue_70_test.rb +0 -55
  151. data/test/acceptance/mocha_example_test.rb +0 -98
  152. data/test/acceptance/mocha_test_result_test.rb +0 -84
  153. data/test/acceptance/mock_test.rb +0 -100
  154. data/test/acceptance/mock_with_initializer_block_test.rb +0 -51
  155. data/test/acceptance/mocked_methods_dispatch_test.rb +0 -78
  156. data/test/acceptance/multiple_expectations_failure_message_test.rb +0 -68
  157. data/test/acceptance/optional_parameters_test.rb +0 -70
  158. data/test/acceptance/parameter_matcher_test.rb +0 -337
  159. data/test/acceptance/partial_mocks_test.rb +0 -47
  160. data/test/acceptance/prepend_test.rb +0 -88
  161. data/test/acceptance/raise_exception_test.rb +0 -39
  162. data/test/acceptance/return_value_test.rb +0 -52
  163. data/test/acceptance/sequence_test.rb +0 -192
  164. data/test/acceptance/states_test.rb +0 -70
  165. data/test/acceptance/stub_any_instance_method_defined_on_superclass_test.rb +0 -34
  166. data/test/acceptance/stub_any_instance_method_test.rb +0 -238
  167. data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +0 -106
  168. data/test/acceptance/stub_class_method_defined_on_class_test.rb +0 -78
  169. data/test/acceptance/stub_class_method_defined_on_module_test.rb +0 -75
  170. data/test/acceptance/stub_class_method_defined_on_superclass_test.rb +0 -112
  171. data/test/acceptance/stub_everything_test.rb +0 -56
  172. data/test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb +0 -93
  173. data/test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb +0 -69
  174. data/test/acceptance/stub_instance_method_defined_on_class_test.rb +0 -69
  175. data/test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb +0 -75
  176. data/test/acceptance/stub_instance_method_defined_on_module_test.rb +0 -75
  177. data/test/acceptance/stub_instance_method_defined_on_object_class_test.rb +0 -75
  178. data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +0 -70
  179. data/test/acceptance/stub_instance_method_defined_on_superclass_test.rb +0 -72
  180. data/test/acceptance/stub_module_method_test.rb +0 -163
  181. data/test/acceptance/stub_test.rb +0 -52
  182. data/test/acceptance/stubba_example_test.rb +0 -102
  183. data/test/acceptance/stubba_test_result_test.rb +0 -66
  184. data/test/acceptance/stubbing_error_backtrace_test.rb +0 -64
  185. data/test/acceptance/stubbing_frozen_object_test.rb +0 -88
  186. data/test/acceptance/stubbing_method_accepting_block_parameter_test.rb +0 -48
  187. data/test/acceptance/stubbing_method_unnecessarily_test.rb +0 -65
  188. data/test/acceptance/stubbing_nil_test.rb +0 -59
  189. data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +0 -130
  190. data/test/acceptance/stubbing_non_existent_class_method_test.rb +0 -157
  191. data/test/acceptance/stubbing_non_existent_instance_method_test.rb +0 -147
  192. data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +0 -130
  193. data/test/acceptance/stubbing_non_public_class_method_test.rb +0 -163
  194. data/test/acceptance/stubbing_non_public_instance_method_test.rb +0 -143
  195. data/test/acceptance/stubbing_on_non_mock_object_test.rb +0 -64
  196. data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +0 -35
  197. data/test/acceptance/throw_test.rb +0 -45
  198. data/test/acceptance/unexpected_invocation_test.rb +0 -25
  199. data/test/acceptance/unstubbing_test.rb +0 -168
  200. data/test/assertions.rb +0 -6
  201. data/test/deprecation_disabler.rb +0 -15
  202. data/test/execution_point.rb +0 -36
  203. data/test/integration/mini_test_test.rb +0 -8
  204. data/test/integration/shared_tests.rb +0 -174
  205. data/test/integration/test_unit_test.rb +0 -8
  206. data/test/method_definer.rb +0 -24
  207. data/test/mini_test_result.rb +0 -90
  208. data/test/minitest_result.rb +0 -49
  209. data/test/simple_counter.rb +0 -13
  210. data/test/test_helper.rb +0 -50
  211. data/test/test_runner.rb +0 -58
  212. data/test/test_unit_result.rb +0 -20
  213. data/test/unit/any_instance_method_test.rb +0 -132
  214. data/test/unit/array_inspect_test.rb +0 -16
  215. data/test/unit/backtrace_filter_test.rb +0 -19
  216. data/test/unit/cardinality_test.rb +0 -56
  217. data/test/unit/central_test.rb +0 -100
  218. data/test/unit/change_state_side_effect_test.rb +0 -41
  219. data/test/unit/class_method_test.rb +0 -223
  220. data/test/unit/class_methods_test.rb +0 -40
  221. data/test/unit/configuration_test.rb +0 -38
  222. data/test/unit/date_time_inspect_test.rb +0 -21
  223. data/test/unit/exception_raiser_test.rb +0 -42
  224. data/test/unit/expectation_list_test.rb +0 -82
  225. data/test/unit/expectation_test.rb +0 -497
  226. data/test/unit/hash_inspect_test.rb +0 -16
  227. data/test/unit/hooks_test.rb +0 -29
  228. data/test/unit/in_state_ordering_constraint_test.rb +0 -43
  229. data/test/unit/method_matcher_test.rb +0 -28
  230. data/test/unit/mock_test.rb +0 -341
  231. data/test/unit/mockery_test.rb +0 -151
  232. data/test/unit/module_methods_test.rb +0 -19
  233. data/test/unit/multiple_yields_test.rb +0 -18
  234. data/test/unit/no_yields_test.rb +0 -18
  235. data/test/unit/object_inspect_test.rb +0 -38
  236. data/test/unit/object_methods_test.rb +0 -46
  237. data/test/unit/parameter_matchers/all_of_test.rb +0 -26
  238. data/test/unit/parameter_matchers/any_of_test.rb +0 -26
  239. data/test/unit/parameter_matchers/anything_test.rb +0 -21
  240. data/test/unit/parameter_matchers/equals_test.rb +0 -25
  241. data/test/unit/parameter_matchers/has_entries_test.rb +0 -51
  242. data/test/unit/parameter_matchers/has_entry_test.rb +0 -129
  243. data/test/unit/parameter_matchers/has_key_test.rb +0 -55
  244. data/test/unit/parameter_matchers/has_value_test.rb +0 -57
  245. data/test/unit/parameter_matchers/includes_test.rb +0 -59
  246. data/test/unit/parameter_matchers/instance_of_test.rb +0 -25
  247. data/test/unit/parameter_matchers/is_a_test.rb +0 -25
  248. data/test/unit/parameter_matchers/kind_of_test.rb +0 -25
  249. data/test/unit/parameter_matchers/not_test.rb +0 -26
  250. data/test/unit/parameter_matchers/regexp_matches_test.rb +0 -46
  251. data/test/unit/parameter_matchers/responds_with_test.rb +0 -32
  252. data/test/unit/parameter_matchers/stub_matcher.rb +0 -27
  253. data/test/unit/parameter_matchers/yaml_equivalent_test.rb +0 -25
  254. data/test/unit/parameters_matcher_test.rb +0 -121
  255. data/test/unit/receivers_test.rb +0 -66
  256. data/test/unit/return_values_test.rb +0 -63
  257. data/test/unit/sequence_test.rb +0 -104
  258. data/test/unit/single_return_value_test.rb +0 -14
  259. data/test/unit/single_yield_test.rb +0 -18
  260. data/test/unit/state_machine_test.rb +0 -98
  261. data/test/unit/string_inspect_test.rb +0 -11
  262. data/test/unit/thrower_test.rb +0 -20
  263. data/test/unit/yield_parameters_test.rb +0 -93
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fee7267881fbeec218036679d2d7002f5a2f0f30
4
- data.tar.gz: 8801ccb9858bbafe1a422702ca1d91e19d31c777
2
+ SHA256:
3
+ metadata.gz: 77366bffa410729ac6089097db85ded323e74d1ec7bc6eb0ea13ae4a18b44eac
4
+ data.tar.gz: f9f3c89bbc29393e99ec62e0d1395ed4fa4863d0f790d24bbe6be3537450e4c1
5
5
  SHA512:
6
- metadata.gz: a1a6ca8a2301842c8ecba0db5df9223232af8076e3d4745763307264c635f68ccb2ff13e8b359dad1d03950341f4fd226cbbda3ef6e22d3bcdea140b776a449e
7
- data.tar.gz: 2cc8b79a37943f4039764780c9c602d30d63e083e6bf375937e387ef6e3f08369f8669dc0b55e99216f15aa6672f9a6033dc52a91e08a172f55b0c59d7f7bc6f
6
+ metadata.gz: 91e277be3c868ef2f6655016a53f040835b8e9d6390c789b6f047be72e9b96726865eefcb161b86d0f8e89ead1c58e9adbf1a1cbcdf9cba8a0f0b536de86222d
7
+ data.tar.gz: 4b7bf751e350762a5a3d9cd17fbe1a590ff5122a718417b75304fa86f8323b20652a24584cedabd859395aeef004402e57c70c15cd88746032659b0d9df4cccf
@@ -0,0 +1 @@
1
+ github: floehopper
data/.rubocop.yml ADDED
@@ -0,0 +1,61 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.2 # closest to required_ruby_version of '>= 1.8.6'
5
+
6
+ # Even the reference in the documentation suggests that you should prefer
7
+ # `alias_method` vs `alias`, so I don't understand why that isn't the default.
8
+ Style/Alias:
9
+ EnforcedStyle: prefer_alias_method
10
+
11
+ Style/Documentation:
12
+ Enabled: false
13
+
14
+ # Enumerable#each_with_object only available since Ruby v1.9
15
+ Style/EachWithObject:
16
+ Enabled: false
17
+
18
+ # Kernel#__dir__ has only been available since Ruby v2.0
19
+ Style/ExpandPathArguments:
20
+ Enabled: false
21
+
22
+ # Kernel#format has only supported named references since Ruby v1.9
23
+ Style/FormatStringToken:
24
+ EnforcedStyle: unannotated
25
+
26
+ # ruby19 style has only been supported since Ruby v1.9
27
+ Style/HashSyntax:
28
+ EnforcedStyle: hash_rockets
29
+
30
+ # I'm not keen on this cop, because it's easy to miss the conditional
31
+ # I think the results are particularly unhelpful when Metrics/LineLength is big
32
+ Style/IfUnlessModifier:
33
+ Enabled: false
34
+
35
+ # Lambda literal syntax has only been supported since Ruby v2.0
36
+ Style/Lambda:
37
+ EnforcedStyle: lambda
38
+
39
+ # Symbol array literal syntax has only been supported since Ruby v2.0
40
+ Style/SymbolArray:
41
+ Enabled: false
42
+
43
+ # I'm not keen on this cop, because it's easy to miss the while/until
44
+ Style/WhileUntilModifier:
45
+ Enabled: false
46
+
47
+ # This recently introduced cop seems to have stirred up some controversy
48
+ Style/AccessModifierDeclarations:
49
+ Enabled: false
50
+
51
+ # Enabling this cop results in an "Infinite loop detected" exception
52
+ Layout/AccessModifierIndentation:
53
+ Enabled: false
54
+
55
+ # Allow long comment lines, e.g. YARD documentation
56
+ Metrics/LineLength:
57
+ IgnoredPatterns: ['\A\s*#']
58
+
59
+ # It's not possible to set TargetRubyVersion to Ruby < v2.2
60
+ Gemspec/RequiredRubyVersion:
61
+ Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,27 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2019-11-16 18:15:36 +0000 using RuboCop version 0.58.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 57
10
+ Metrics/AbcSize:
11
+ Max: 26
12
+
13
+ # Offense count: 23
14
+ # Configuration parameters: CountComments.
15
+ Metrics/ClassLength:
16
+ Max: 366
17
+
18
+ # Offense count: 172
19
+ # Configuration parameters: CountComments.
20
+ Metrics/MethodLength:
21
+ Max: 31
22
+
23
+ # Offense count: 545
24
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
25
+ # URISchemes: http, https
26
+ Metrics/LineLength:
27
+ Max: 180
data/.yardopts CHANGED
@@ -1,3 +1,4 @@
1
+ --output-dir docs
1
2
  --template-path yard-templates
2
3
  --no-private
3
4
  lib/mocha/api.rb
data/CONTRIBUTING.md CHANGED
@@ -1,12 +1,7 @@
1
1
  * Pull requests are welcomed.
2
2
  * Fork the repository.
3
3
  * Make your changes in a branch.
4
- * Add tests for new behaviour. Modify/remove existing tests for changes to existing behaviour.
5
- * Run `bin/build-matrix` from the root directory and ensure all the tests pass.
6
- * This script depends on `rbenv` being installed.
7
- * You must have all the ruby versions listed in `.travis.yml` under the `rvm` key installed (currently 1.8.7, 1.9.3 & 2.0.0).
8
- * I use `rbenv-aliases` to alias the patch versions.
9
- * Note that the build matrix takes quite a while to run.
10
- * Send us a pull request from your fork/branch.
11
- * Wait for your pull request to build on [Travis CI](https://travis-ci.org/freerange/mocha).
12
- * I will not accept pull requests with failing tests.
4
+ * Add/modify/remove tests as appropriate.
5
+ * Open a pull request based on a branch on your fork.
6
+ * Wait for your pull request build to pass on [Circle CI](https://app.circleci.com/pipelines/github/freerange/mocha).
7
+ * Pull requests with failing tests will not be accepted.
data/README.md CHANGED
@@ -1,12 +1,15 @@
1
- ## Mocha [![build status](https://secure.travis-ci.org/freerange/mocha.png)](https://secure.travis-ci.org/freerange/mocha) [![Gem Version](https://badge.fury.io/rb/mocha.png)](http://badge.fury.io/rb/mocha)
1
+ ## Mocha [![CircleCI status of freerange/mocha](https://circleci.com/gh/freerange/mocha.svg?style=shield&circle-token=bc1f6576c77da43ec58badde9273fa4eb1d7f53a)](https://app.circleci.com/pipelines/github/freerange/mocha) [![Gem Version](https://badge.fury.io/rb/mocha.svg)](http://badge.fury.io/rb/mocha) [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=mocha&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=mocha&package-manager=bundler&version-scheme=semver)
2
2
 
3
3
  ### Description
4
4
 
5
- * A Ruby library for mocking and stubbing.
5
+ * A Ruby library for [mocking](http://xunitpatterns.com/Mock%20Object.html) and [stubbing](http://xunitpatterns.com/Test%20Stub.html) - but deliberately not (yet) [faking](http://xunitpatterns.com/Fake%20Object.html) or [spying](http://xunitpatterns.com/Test%20Spy.html).
6
6
  * A unified, simple and readable syntax for both full & partial mocking.
7
7
  * Built-in support for MiniTest and Test::Unit.
8
8
  * Supported by many other test frameworks.
9
9
 
10
+ ### Intended Usage
11
+ Mocha is intended to be used in unit tests for the [Mock Object](http://xunitpatterns.com/Mock%20Object.html) or [Test Stub](http://xunitpatterns.com/Test%20Stub.html) types of [Test Double](http://xunitpatterns.com/Test%20Double.html), not the [Fake Object](http://xunitpatterns.com/Fake%20Object.html) or [Test Spy](http://xunitpatterns.com/Test%20Spy.html) types. Although it would be possible to extend Mocha to allow the implementation of fakes and spies, we have chosen to keep it focused on mocks and stubs.
12
+
10
13
  ### Installation
11
14
 
12
15
  #### Gem
@@ -32,7 +35,7 @@ require 'mocha/test_unit'
32
35
  require 'rubygems'
33
36
  gem 'mocha'
34
37
  require 'minitest/unit'
35
- require 'mocha/mini_test'
38
+ require 'mocha/minitest'
36
39
  ```
37
40
 
38
41
  #### Bundler
@@ -43,59 +46,88 @@ If you're using Bundler, include Mocha in the `Gemfile` and then setup Mocha lat
43
46
 
44
47
  ```ruby
45
48
  # Gemfile
46
- gem "mocha"
49
+ gem 'mocha'
47
50
 
48
51
  # Elsewhere after Bundler has loaded gems e.g. after `require 'bundler/setup'`
49
- require "test/unit"
50
- require "mocha/test_unit"
52
+ require 'test/unit'
53
+ require 'mocha/test_unit'
51
54
  ```
52
55
 
53
56
  ##### MiniTest
54
57
 
55
58
  ```ruby
56
59
  # Gemfile
57
- gem "mocha"
60
+ gem 'mocha'
58
61
 
59
62
  # Elsewhere after Bundler has loaded gems e.g. after `require 'bundler/setup'`
60
- require "minitest/unit"
61
- require "mocha/mini_test"
63
+ require 'minitest/unit'
64
+ require 'mocha/minitest'
62
65
  ```
63
66
 
64
- #### Rails
67
+ ##### RSpec
65
68
 
66
- If you're loading Mocha using Bundler within a Rails application, you should setup Mocha manually e.g. at the bottom of your `test_helper.rb`.
67
-
68
- ##### MiniTest
69
+ RSpec includes a mocha adapter. Just tell RSpec you want to mock with `:mocha`:
69
70
 
70
71
  ```ruby
71
72
  # Gemfile in Rails app
72
73
  gem 'mocha'
73
74
 
74
- # At bottom of test_helper.rb (or at least after `require 'rails/test_help'`)
75
- require 'mocha/mini_test'
75
+ # Within `spec/spec_helper.rb`
76
+ RSpec.configure do |config|
77
+ config.mock_with :mocha
78
+ end
76
79
  ```
77
80
 
78
- #### Rails Plugin
81
+ Note: There is no need to use a require statement to setup Mocha; RSpec does this itself.
79
82
 
80
- Install the Rails plugin...
83
+ ##### Cucumber
81
84
 
82
- $ rails plugin install git://github.com/freerange/mocha.git
85
+ ```ruby
86
+ # In e.g. features/support/mocha.rb
87
+ require 'mocha/api'
88
+
89
+ World(Mocha::API)
90
+
91
+ Around do |scenario, block|
92
+ begin
93
+ mocha_setup
94
+ block.call
95
+ mocha_verify
96
+ ensure
97
+ mocha_teardown
98
+ end
99
+ end
100
+ ```
83
101
 
84
- Note: As of version 0.9.8, the Mocha plugin is not automatically setup at plugin load time. Instead it must be manually setup e.g. at the bottom of your `test_helper.rb`.
102
+ #### Rails
103
+
104
+ If you're loading Mocha using Bundler within a Rails application, you should setup Mocha manually e.g. at the bottom of your `test_helper.rb`.
85
105
 
86
106
  ##### MiniTest
87
107
 
108
+ Note that since Rails v4 (at least), `ActiveSupport::TestCase` has inherited from `Minitest::Test` or its earlier equivalents. Thus unless you are *explicitly* using Test::Unit, you are likely to be using MiniTest.
109
+
88
110
  ```ruby
111
+ # Gemfile in Rails app
112
+ gem 'mocha'
113
+
89
114
  # At bottom of test_helper.rb (or at least after `require 'rails/test_help'`)
90
- require 'mocha/mini_test'
115
+ require 'mocha/minitest'
91
116
  ```
92
117
 
93
- #### Know Issues
118
+ ##### Other Test Framework
119
+
120
+ Follow the instructions for the relevant test framework in the [Bundler](#bundler) section, but ensure that the relevant Mocha file (`mocha/minitest`, `mocha/test_unit`, or `mocha/api`) is required **after** the test framework has been loaded, e.g. at the bottom of `test_helper.rb` or `spec_helper.rb`, or at least after `rails/test_help` has been required.
121
+
122
+ #### Known Issues
94
123
 
124
+ * In Mocha v1.10.0 an undocumented feature of `API#mock`, `API#stub` & `API#stub_everything` was changed. Previously when these methods were passed a single symbol, they returned a mock object that responded to the method identified by the symbol. Now Passing a single symbol is equivalent to passing a single string, i.e. it now defines the 'name' of the mock object.
125
+ * In Mocha v1.2.0 there is a scenario where stubbing a class method originally defined in a module hangs the Ruby interpreter due to [a bug in Ruby v2.3.1](https://bugs.ruby-lang.org/issues/12832). See #272. This was fixed in Mocha v1.2.1.
126
+ * Since v1.1.0 Mocha has used prepended modules internally for stubbing methods. There is [an obscure Ruby bug](https://bugs.ruby-lang.org/issues/12876) in many (but not all) versions of Ruby between v2.0 & v2.3 which under certain circumstances may cause your Ruby interpreter to hang. See the Ruby bug report for more details. The bug has been fixed in Ruby v2.3.3 & v2.4.0.
127
+ * Stubbing an aliased class method, where the original method is defined in a module that's used to `extend` the class doesn't work in Ruby 1.8.x. See stub_method_defined_on_module_and_aliased_test.rb for an example of this behaviour.
95
128
  * 0.13.x versions cause a harmless, but annoying, deprecation warning when used with Rails 3.2.0-3.2.12, 3.1.0-3.1.10 & 3.0.0-3.0.19.
96
129
  * 0.11.x versions don't work with Rails 3.2.13 (`TypeError: superclass mismatch for class ExpectationError`). See #115.
97
130
  * Versions 0.10.2, 0.10.3 & 0.11.0 of the Mocha gem were broken. Please do not use these versions.
98
- * Versions 0.9.6 & 0.9.7 of the Mocha Rails plugin were broken. Please do not use these versions.
99
131
 
100
132
  ### Usage
101
133
 
@@ -193,7 +225,7 @@ class Order
193
225
  def find_all
194
226
  # Database.connection.execute('select * from orders...
195
227
  end
196
-
228
+
197
229
  def number_shipped_since(date)
198
230
  find_all.select { |order| order.shipped_on > date }.length
199
231
  end
@@ -236,7 +268,15 @@ end
236
268
 
237
269
  ### Thread safety
238
270
 
239
- Mocha is currently *not* thread-safe. There are two main reasons for this: (a) in multi-threaded code Mocha exceptions may be raised in a thread other than the one which is running the test and thus a Mocha exception may not be correctly intercepted by Mocha exception handling code; and (b) partial mocking changes the state of objects in the `ObjectSpace` which is shared across all threads in the Ruby process and this access to what is effectively global state is not synchronized.
271
+ Mocha currently *does not* attempt to be thread-safe.
272
+
273
+ #### Can I test multi-threaded code with Mocha?
274
+
275
+ The short answer is no. In multi-threaded code Mocha exceptions may be raised in a thread other than the one which is running the test and thus a Mocha exception may not be correctly intercepted by Mocha exception handling code.
276
+
277
+ #### Can I run my tests across multiple threads?
278
+
279
+ Maybe, but probably not. Partial mocking changes the state of objects in the `ObjectSpace` which is shared across all threads in the Ruby process and this access to what is effectively global state is not synchronized. So, for example, if two tests are running concurrently and one uses `#any_instance` to modify a class, both tests will see those changes immediately.
240
280
 
241
281
  ### Expectation matching / invocation order
242
282
 
@@ -244,11 +284,27 @@ Stubs and expectations are basically the same thing. A stub is just an expectati
244
284
 
245
285
  When a method is invoked on a mock object, the mock object searches through its expectations from newest to oldest to find one that matches the invocation. After the invocation, the matching expectation might stop matching further invocations.
246
286
 
247
- See the [documentation](http://gofreerange.com/mocha/docs/Mocha/Mock.html) for `Mocha::Mock` for further details.
287
+ See the [documentation](https://mocha.jamesmead.org/Mocha/Mock.html) for `Mocha::Mock` for further details.
288
+
289
+ ### Configuration
290
+
291
+ If you want, Mocha can generate a warning or raise an exception when:
292
+
293
+ * stubbing a method unnecessarily
294
+ * stubbing method on a non-mock object
295
+ * stubbing a non-existent method
296
+ * stubbing a non-public method
297
+
298
+ See the [documentation](https://mocha.jamesmead.org/Mocha/Configuration.html) for `Mocha::Configuration` for further details.
299
+
300
+ ##### MOCHA_OPTIONS
301
+ `MOCHA_OPTIONS` is an environment variable whose value can be set to a comma-separated list, so that we can specify multiple options e.g. `MOCHA_OPTIONS=debug,use_test_unit_gem`.
302
+ Only the following values are currently recognized and have an effect:
303
+ * `debug`: Enables a debug mode which will output backtraces for each deprecation warning. This is useful for finding where in the test suite the deprecated calls are.
248
304
 
249
305
  ### Useful Links
250
306
 
251
- * [Official Documentation](http://gofreerange.com/mocha/docs/)
307
+ * [Official Documentation](https://mocha.jamesmead.org)
252
308
  * [Source Code](http://github.com/freerange/mocha)
253
309
  * [Mailing List](http://groups.google.com/group/mocha-developer)
254
310
  * [James Mead's Blog](http://jamesmead.org/blog/)
@@ -262,9 +318,39 @@ See the [documentation](http://gofreerange.com/mocha/docs/Mocha/Mock.html) for `
262
318
 
263
319
  See this [list of contributors](https://github.com/freerange/mocha/graphs/contributors).
264
320
 
265
- ### Translations
321
+ ### Releasing a new version
322
+
323
+ * Update the RELEASE.md file with a summary of changes
324
+ * Bump the version in `lib/mocha/version.rb`
325
+ * Commit & push to GitHub
326
+ * Check CircleCI build is passing - https://app.circleci.com/pipelines/github/freerange/mocha
266
327
 
267
- * [Serbo-Croatian](http://science.webhostinggeeks.com/mocha) by [WHG Team](http://webhostinggeeks.com/). (may be out-of-date)
328
+ * Sign in to Google Analytics - https://analytics.google.com/analytics/web/
329
+ * Find the web property ID for floehopper (625523) > Mocha Documentation (UA-625523-7)
330
+ * Generate documentation:
331
+
332
+ ```bash
333
+ $ MOCHA_GENERATE_DOCS=true bundle install
334
+
335
+ $ MOCHA_GENERATE_DOCS=true GOOGLE_ANALYTICS_WEB_PROPERTY_ID=UA-625523-7 rake generate_docs
336
+ ```
337
+ * Commit documentation & push to GitHub
338
+ * Sign in to rubygems.org and find API key - https://rubygems.org/profile/edit
339
+
340
+ ```bash
341
+ $ curl -u james@floehopper.org https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials; chmod 0600 ~/.gem/credentials`
342
+ ```
343
+
344
+ * Release gem to Rubygems:
345
+
346
+ ```bash
347
+ $ rake release
348
+ [runs tests]
349
+ mocha 1.2.0 built to pkg/mocha-1.2.0.gem.
350
+ Tagged v1.2.0.
351
+ Pushed git commits and tags.
352
+ Pushed mocha 1.2.0 to rubygems.org.
353
+ ```
268
354
 
269
355
  ### History
270
356
 
data/RELEASE.md CHANGED
@@ -1,5 +1,252 @@
1
1
  # Release Notes
2
2
 
3
+ ## 1.13.0
4
+
5
+ ### External changes
6
+
7
+ * Add `ParameterMatchers#has_keys` - thanks to @cstyles for #512 (18d8104)
8
+ * Fix misleading exception message in `ParameterMatchers#has_entry` - thanks to @cstyles for #513 (9c4ef13)
9
+ * Only add dependency on rubocop if we're actually going to use it (f2f879f)
10
+ * Fix rake dependency constraints for older Ruby versions (7ce5f29)
11
+
12
+ ### Internal changes
13
+
14
+ * Check documentation can be generated as part of CircleCI build (b30d9a9)
15
+ * Add --fail-on-warning option to yard rake task (53a6ee3)
16
+ * Add a weekly scheduled build to the CircleCI build (fd2a4c6)
17
+ * Add Ruby v1.8 to the CircleCI build matrix (818ca03)
18
+ * Add API token to fix CircleCI badge in README (607c5aa)
19
+ * Provide wrapped option for #mocha_inspect on hashes & arrays (d8f44bc)
20
+ * Use CircleCI instead of TravisCI for automated builds (c98c6ec)
21
+ * Switch to newer default Travis CI build env (c78f75c)
22
+ * Use latest Ruby versions in Travis CI builds (9e0043a)
23
+ * Use latest JRuby v9.2.18 in Travis CI builds (8c99a1b)
24
+ * Use consistent JRuby versions in Travis CI builds (0f849aa)
25
+ * Use more recent version of JRuby in Travis CI build matrix (58653db)
26
+
27
+ ## 1.12.0
28
+
29
+ ### External changes
30
+
31
+ * Various improvements to README inspired by #207 and #390 - thanks to @nitishr for his work on #390 (fed0eee6)
32
+ * Improve documentation related to `StateMachine` classes - thanks to @nitishr (#425 & #427)
33
+ * Fix regression in cardinality introduced in v1.10.0 (59454a8) and reported in #473 - thanks to @srvance for reporting and @nitishr for fixing (#474)
34
+ * Fix documentation for `Mocha::Expectation#when` - thanks to @olleolleolle (b4f59daa & #477)
35
+ * Remove `Mocha::Mock#respond_to?` from documentation - thanks to @nitishr (#480)
36
+ * Improvements to documentation for `Expectation#yields` & `#multiple_yields` - thanks to @andyw8 for reporting in #495 (1b6571c)
37
+ * Remove documentation & tests from gem to reduce its size by over 50% - thanks to @gabetax (#500)
38
+ * Update documentation to point to travis-ci.com instead of travis-ci.org
39
+
40
+ ### Internal changes
41
+
42
+ * Refactor `StateMachine`-related classes - thanks to @nitishr (#425 & #427)
43
+ * Remove redundant test - thanks to @nitishr (8e4f1a7c)
44
+ * Add Ruby 2.7 to Travis CI matrix - thanks to @bastelfreak (fc5ea2f2)
45
+ * Simplify `Mockery` - thanks to @nitishr (#449)
46
+ * Update Travis CI badge to point to main vs master branch (bd8028f8)
47
+ * Generate docs using newer version of yard (v0.9.25) (c619afac)
48
+ * Manually upgrade jquery in docs from v1.7.1 -> v1.9.0 to fix CVE-2017-16011 (211098a5, dd5eeedb & 1b76e4d5; also see #492)
49
+ * Remove reference to non-existent jquery source map to fix error in Chrome developer tools (20156555)
50
+ * Temporarily ignore Ruby v1.8.7 build failures (e5b9feef)
51
+
52
+ ## 1.11.2
53
+
54
+ ### External changes
55
+
56
+ * Fix regression introduced in v1.10.0 that meant `Object#inspect` was called unnecessarily (368abd98)
57
+ * Warn when mock object receives invocations in another test - thanks to @nitishr (#442)
58
+ * Avoid rubocop comments appearing in YARD-generated docs (d8019eed)
59
+
60
+ ### Internal changes
61
+
62
+ * Replace `StubbedMethod#original_method` & `#original_visibility` attribute reader methods with instance variables - thanks to @nitishr (d917f332)
63
+ * Set up `MochaExampleTest` & `StubbaExampleTest` as acceptance tests - thanks to @nitishr (4881cc58)
64
+ * Delete unused `PrettyParameters` class - thanks to @nitishr (314ea922)
65
+
66
+ ## 1.11.1
67
+
68
+ ### External changes
69
+
70
+ * The `reinstate_undocumented_behaviour_from_v1_9` configuration option is now enabled by default to give people a chance to see and fix the relevant deprecation warnings before the behaviour is removed in a future release (b91b1c9e)
71
+
72
+ ## 1.11.0
73
+
74
+ ### External changes
75
+
76
+ * Add `Expectation#with_block_given` & `Expectation#with_no_block_given` (#441).
77
+ * Allows non-deprecated solution for #382. Thanks to @yemartin for reporting and to @techbelly & @nitishr for feedback.
78
+ * Fix issue with non-Array arguments passed to `Expectation#multiple_yields` (#444).
79
+ * The undocumented behaviour is now properly supported and documented.
80
+
81
+ ### Internal changes
82
+
83
+ * Move static YARD options from Rake task to `.yardopts` file - thanks to @nitishr (#429)
84
+ * Simplify implementation of yielding functionality - thanks to @nitishr (#439)
85
+ * Add missing require statement to `acceptance_test_helper.rb` (1070fc02)
86
+ * Add some baseline acceptance tests for yielding behaviour (c2cac911)
87
+ * Display a sponsor button on GitHub repo page (9fc5911b)
88
+ * Use new Deprecation.warning behaviour in `Invocation#call` (932d1166)
89
+
90
+ ## 1.10.2
91
+
92
+ * Optionally reinstate undocumented behaviour from v1.9. This introduces a new configuration option (`reinstate_undocumented_behaviour_from_v1_9`) to reinstate a couple of bits of undocumented behaviour from v1.9 which were changed in v1.10 without any prior deprecation warning (#438):
93
+ * The behaviour of `API#mock`, `API#stub` and `API#stub_everything` when called with a symbol as the first argument.
94
+ * The behaviour of `Expectation#yields` and `Expectation#multiple_yields` when the stubbed method is called without a block.
95
+
96
+ ## 1.10.1
97
+
98
+ * Ensure ObjectMethods & ClassMethods included when API extended (43778756)
99
+ * Fix regression in `any_instance` stubbing of methods on object which has an implementation of `#respond_to?` that depends on the object's internal state - thanks to @rafaelfranca for reporting & @nitishr for fixing (#432, #434, 469d4b17)
100
+
101
+ ## 1.10.0
102
+
103
+ * Improve deprecation warning when requiring 'mocha/setup' (388f44d7)
104
+ * Add documentation for Cucumber integration (13ab797b)
105
+ * Add documentation about an undocumented feature of `API#mock`, `API#stub` & `API#stub_everything` being changed (7ed2e4e7, d30c1717)
106
+
107
+ ## 1.10.0.beta.1
108
+
109
+ * Hide `ClassMethods#method_visibility` & `#method_exists?` methods to avoid clash with Rails (#428)
110
+
111
+ ## 1.10.0.alpha
112
+
113
+ ### External changes
114
+
115
+ * Remove dependency on metaclass gem (#49, #365)
116
+ * Accept symbol (as well as a string) as mock/stub name - thanks to @nitishr (#347, #353, #377)
117
+ * More realistic examples in documentation for `Expectation#yields` and `#multiple_yields` - thanks to @nitishr (#352, #383)
118
+ * Improve documentation for `Mock#responds_like` & `#responds_like_instance_of` - thanks to @nitishr (#337, #384)
119
+ * Make `Expectation#yields` & `Expectation#multiple_yields` fail when the caller of the stubbed method does not provide a block. This is a change to an undocumented aspect of the public API's behaviour. If this causes your tests to fail, then fix it by removing the unnecessary call to `Expectation#yields` or `Expectation#multiple_yields` - thanks to @nitishr (#382)
120
+ * Document `MOCHA_OPTIONS` in README - thanks to @nitishr (#311, #386)
121
+ * Add documentation to explain how Mocha is intended to be used - thanks to @nitishr (#330, #385)
122
+ * Deprecation warning if integration using 'mocha/test_unit' or 'mocha/minitest' fails - thanks to @nitishr (#229, #389, c6032d0b)
123
+ * Require at least one specified sequence for `Expectation#in_sequence` - thanks to @nitishr (#79, #396, 9020248a)
124
+ * Make signatures of `Mock#unstub` & `ObjectMethods#unstub` consistent - thanks to @nitishr (#397, f04d437)
125
+ * Deprecate requiring 'mocha/setup' (36adf880)
126
+ * Optionally display matching invocations alongside expectations - thanks to @nitishr (#178, #394, 00f0540, #410)
127
+ * Put deprecations into effect (#400, #418):
128
+ * Remove deprecated 'mocha_standalone.rb' & 'mocha/standalone.rb'
129
+ * Fail fast if no test library loaded
130
+ * Removed optional block for `Mocha::API#mock`, `#stub` & `#stub_everything`
131
+ * Remove deprecated `ParameterMatchers#has_equivalent_query_string` method
132
+ * Remove deprecated 'mocha/mini_test.rb'
133
+ * Fix typo in docs for `Mocha::Configuration.prevent` (266ce71c)
134
+ * New-style configuration (see documentation for `Mocha::Configuration`) (#407, #421)
135
+ * Deprecate support for Ruby versions earlier than v1.9 (#325, c5f8496d)
136
+ * Deprecate support for versions of test-unit & minitest which need monkey-patching (a34e1a88)
137
+ * Deprecate old-style Rails plugin (#403, 2df77134)
138
+ * Documentation fixes & improvements which also fix YARD warnings (472d5416, a2c0d64a)
139
+
140
+ ### Internal changes
141
+
142
+ * Pin minitest to v5.11.3 for Ruby v1.8.7 to fix build; minitest no longer supports Ruby v1.8.7 (4a0a580)
143
+ * Upgrade JRuby to v9.2.8.0 in Travis CI builds (aa29b3f)
144
+ * Only run rubocop for MRI Ruby versions & non-integration test builds (8f1c6af)
145
+ * Reduce duplication in any instance method class - thanks to @nitishr (#378)
146
+ * Simplify `AnyInstanceMethod`, `ClassMethod`, `InstanceMethod`, `ModuleMethod` class hierarchy - thanks to @nitishr (#381)
147
+ * Simplify `ClassMethods#method_exists?` & `ObjectMethods#method_exists?` making them consistent - thanks to @nitishr (#270, #362, #370)
148
+ * Don't override definition of `singleton_class` in `ClassMethods` - thanks to @nitishr (#391, #392)
149
+ * Do not include 'method_definer' methods into all objects (#268, #402)
150
+ * Distinguish different `ObjectMethods` modules (#268, #404)
151
+ * Pass invocation to expectation list methods - thanks to @nitishr (#408, #409, #411)
152
+ * Consistently use `assert_raises` - thanks to @nitishr (#405, #412, a66b7bed)
153
+ * Update Ruby & JRuby versions in Travis CI config (18cb1a93, eb061c53)
154
+ * Rubocop improvements (aa16ea67...6f4db70b, 2a1240e6...e95716ae)
155
+ * Fix inconsistency in CardinalityTest (aa10e0a8)
156
+ * Fix test failures on Mac OSX Catalina - thanks to @nitishr (#413, #417, #419, 8a0f2535)
157
+ * Remove default argument in `Expectation#invoke` - thanks to @nitishr (#414, #420)
158
+
159
+ ## 1.9.0
160
+
161
+ * Add TruffleRuby to Travis CI build matrix - thanks to @deepj (#354)
162
+ * Explicitly set Travis CI OS to Ubuntu Trusty 14.04 (ded1fa45)
163
+ * Expand explanation of thread-safety concerns - thanks to @techbelly (#357)
164
+ * Refactor class method and any instance method - thanks to @chrisroos (#358)
165
+ * Rely on default bundler version in Travis CI builds (3352e9c5)
166
+ * Fix local build-matrix script (11abe231)
167
+ * No need to install latest bundler in build-matrix script (8247a894)
168
+
169
+ ## 1.8.0
170
+
171
+ * Constrain rubocop version to avoid breaking Travis CI builds (05e507f5)
172
+ * Avoid calling Kernel#format from ObjectMethods#mocha_inspect - thanks to @hoffmanilya (#345)
173
+ * Fix build matrix script (#346)
174
+ * Avoid deprecation warning in gemspec (4976e0bc)
175
+ * Removed link to documentation translation (ef428ea2)
176
+ * Don't use the new bundler v2 in builds (683ded9b)
177
+ * Moved documentation from https://gofreerange.com/mocha/docs to https://mocha.jamesmead.org/ [683ded...a17fde](https://github.com/freerange/mocha/compare/683ded...a17fde)
178
+
179
+ ## 1.7.0
180
+
181
+ * Update Ruby & JRuby versions in Travis CI config (9bf55631 & 3883af7e)
182
+ * Simplify gemspec (63744f86)
183
+ * Add rubocop and fix most cop violations (#341)
184
+ * Use Kernel#warn for deprecations - thanks to @etiennebarrie (#333, 196970a)
185
+
186
+ ## 1.6.0
187
+
188
+ * Fix subtle bug in setting correct visibility of stubbed module methods on `Kernel` or `Object` - thanks to @chrisroos (#295)
189
+ * Avoid mocks for partial mocking leaking into subsequent tests - thanks to @skliew for reporting (#331)
190
+ * Remove OpenCollective badge, backers & sponsors (a283a079)
191
+ * Change gem version badge to SVG format and add SemVer stability badge - thanks to @greysteil (#335)
192
+ * Improve documentation for Configuration (#236)
193
+
194
+ ## 1.5.0
195
+
196
+ * Prevent use of Mocha outside the context of a test/example - thanks to @andyw8 & @lzap (#327)
197
+
198
+ ## 1.4.0
199
+
200
+ * Fix deprecation warning for `assert_nil` in `ClassMethodTest` (#308 & #309)
201
+ * Display file and line number in deprecation warning - thanks to @chrisarcand (#310, #312 & #313)
202
+ * Rename `mocha/mini_test.rb` to `mocha/minitest.rb` - thanks to @grosser (#320 & #322)
203
+ * Fix warning when delegating to mock in Ruby 2.4 - thanks to @tjvc (#321 & #323)
204
+ * Updates to Travis CI configuration ([73af600..9732726](https://github.com/freerange/mocha/compare/73af600...9732726) & 0426e5e)
205
+
206
+ ## 1.3.0
207
+
208
+ * Ensure all tests run individually - thanks to @chrisroos (#267)
209
+ * Update Travis CI build status badge to show master branch status (#264)
210
+ * Correct RSpec section of the README - thanks to @myronmarston (0cc039c8)
211
+ * Fix pretty printing of quotes in `String#mocha_inspect` (#215 & #223)
212
+ * Add release instructions to README - thanks to @chrisroos (70a5febd & 3c664df7)
213
+ * Require at least Ruby v1.8.7 in gemspec - thanks to @knappe (3e20be8e)
214
+ * Remove redundant InstanceMethod#method_exists? - thanks to @chrisroos (8f58eddf)
215
+ * Reduce risk of hitting bug 12832 in Ruby v2.3 - thanks to @chrisroos (#277 & eca7560c)
216
+ * Fix JRuby build - thanks to @headius (jruby/jruby#4250) & @chrisroos (#274)
217
+ * Add latest stable version of JRuby to Travis CI build matrix (#288)
218
+ * Fix Ruby v1.8.7 builds on Travis CI (928b5a40 & 460dce5b)
219
+ * Deprecate passing block to mock object constructor (#290)
220
+ * Add a known issue to README for Ruby bug 12876 (#276)
221
+ * Add Ruby 2.4 and ruby-head to Travis CI build matrix - thanks to @junaruga (#297)
222
+ * Fix `Mocha::ParameterMatchers#includes` for `Array` values - thanks to @timcraft (#302)
223
+ * Use faster container-based virtual environments for Travis CI builds (#305)
224
+ * Rename `Mocha::ParameterMatchers::QueryStringMatches` to `QueryString` (#306)
225
+ * Handle blank parameter value for query string matcher - thanks to @weynsee (#303 & #304)
226
+ * Rename `Mocha::ParameterMatchers::QueryString` -> `EquivalentUri` (#307)
227
+ * Use `do ... end` instead of `{ ... }` in acceptance tests - thanks to @chrisroos (#294)
228
+
229
+ ## 1.2.1
230
+
231
+ * Fixed #272. Workaround Ruby bug 12832 which caused interpreter to hang. See https://bugs.ruby-lang.org/issues/12832. Thanks to @chrisroos & @petems (6f1c8b9b, #273).
232
+
233
+ ## 1.2.0
234
+
235
+ * Always use prepended module to stub class & instance methods for Ruby v2+ - thanks to @grosser & @chrisroos (43d56671, #244)
236
+ * Always use prepended module to stub AnyInstance methods in Ruby v2+ - thanks to @chrisroos (#262)
237
+ * Always set visibility of stub method to match stubbed method on included module - thanks to @grosser & @chrisroos (e87c03b0, #248)
238
+ * Always set visibility to stub method to match stubbed method on superclass - thanks to @chrisroos (38d902ad)
239
+ * Allow stubbing of method to which any instance responds (#200)
240
+ * Allow `includes` matcher to take matcher arguments - thanks to @lazyatom (#217)
241
+ * Avoid exception in older version of Rubygems - thanks to @chrisroos (78d930a7)
242
+ * Add licenses to gemspec as requested by @coreyhaines (#201)
243
+ * Fix typo in README - thanks to @jaredbeck (6119460d)
244
+ * Added section about using Mocha with RSpec & Rails to README (#221)
245
+ * Fix documentation for Mocha::API#stub method - thanks to @raeno (599b1dcd)
246
+ * Added backers and sponsors from OpenCollective - thanks to @piamancini (#253)
247
+ * Fix typo in docs for equals - thanks to @alexcoco (#254)
248
+ * Add known issue for Ruby v1.8 to README - thanks to @chrisroos (2c642096)
249
+
3
250
  ## 1.1.0
4
251
 
5
252
  * Set visibility of any instance stub method.
@@ -374,7 +621,7 @@ Hash with wrong number of entries.
374
621
 
375
622
  ## 0.5.0
376
623
 
377
- - Parameter Matchers - Ive added a few Hamcrest-style parameter matchers which are designed to be used inside Expectation#with. The following matchers are currently available: anything(), includes(), has_key(), has_value(), has_entry(), all_of() & any_of(). More to follow soon. The idea is eventually to get rid of the nasty parameter_block option on Expectation#with.
624
+ - Parameter Matchers - I've added a few Hamcrest-style parameter matchers which are designed to be used inside Expectation#with. The following matchers are currently available: anything(), includes(), has_key(), has_value(), has_entry(), all_of() & any_of(). More to follow soon. The idea is eventually to get rid of the nasty parameter_block option on Expectation#with.
378
625
 
379
626
  object = mock()
380
627
  object.expects(:method).with(has_key('key_1'))