mocha 1.0.0.alpha → 1.10.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (313) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +61 -0
  3. data/.rubocop_todo.yml +27 -0
  4. data/CONTRIBUTING.md +7 -0
  5. data/README.md +136 -42
  6. data/RELEASE.md +166 -16
  7. data/Rakefile +52 -36
  8. data/bin/build-matrix +32 -21
  9. data/docs/CNAME +1 -0
  10. data/docs/Mocha.html +254 -0
  11. data/docs/Mocha/API.html +1129 -0
  12. data/docs/Mocha/ClassMethods.html +339 -0
  13. data/docs/Mocha/Configuration.html +1383 -0
  14. data/docs/Mocha/Expectation.html +2654 -0
  15. data/docs/Mocha/ExpectationError.html +152 -0
  16. data/docs/Mocha/ExpectationErrorFactory.html +260 -0
  17. data/docs/Mocha/Hooks.html +370 -0
  18. data/docs/Mocha/Integration.html +125 -0
  19. data/docs/Mocha/Integration/MiniTest.html +123 -0
  20. data/docs/Mocha/Integration/MiniTest/Adapter.html +164 -0
  21. data/docs/Mocha/Integration/TestUnit.html +123 -0
  22. data/docs/Mocha/Integration/TestUnit/Adapter.html +164 -0
  23. data/docs/Mocha/Mock.html +1237 -0
  24. data/docs/Mocha/ObjectMethods.html +765 -0
  25. data/docs/Mocha/ParameterMatchers.html +2961 -0
  26. data/docs/Mocha/ParameterMatchers/AllOf.html +153 -0
  27. data/docs/Mocha/ParameterMatchers/AnyOf.html +153 -0
  28. data/docs/Mocha/ParameterMatchers/AnyParameters.html +153 -0
  29. data/docs/Mocha/ParameterMatchers/Anything.html +153 -0
  30. data/docs/Mocha/ParameterMatchers/Base.html +441 -0
  31. data/docs/Mocha/ParameterMatchers/Equals.html +153 -0
  32. data/docs/Mocha/ParameterMatchers/EquivalentUri.html +153 -0
  33. data/docs/Mocha/ParameterMatchers/HasEntries.html +153 -0
  34. data/docs/Mocha/ParameterMatchers/HasEntry.html +153 -0
  35. data/docs/Mocha/ParameterMatchers/HasKey.html +153 -0
  36. data/docs/Mocha/ParameterMatchers/HasValue.html +153 -0
  37. data/docs/Mocha/ParameterMatchers/Includes.html +153 -0
  38. data/docs/Mocha/ParameterMatchers/InstanceOf.html +153 -0
  39. data/docs/Mocha/ParameterMatchers/IsA.html +153 -0
  40. data/docs/Mocha/ParameterMatchers/KindOf.html +153 -0
  41. data/docs/Mocha/ParameterMatchers/Not.html +153 -0
  42. data/docs/Mocha/ParameterMatchers/Optionally.html +153 -0
  43. data/docs/Mocha/ParameterMatchers/RegexpMatches.html +153 -0
  44. data/docs/Mocha/ParameterMatchers/RespondsWith.html +153 -0
  45. data/docs/Mocha/ParameterMatchers/YamlEquivalent.html +153 -0
  46. data/docs/Mocha/Sequence.html +149 -0
  47. data/docs/Mocha/StateMachine.html +527 -0
  48. data/docs/Mocha/StateMachine/State.html +140 -0
  49. data/docs/Mocha/StateMachine/StatePredicate.html +140 -0
  50. data/docs/Mocha/StubbingError.html +150 -0
  51. data/docs/_index.html +519 -0
  52. data/docs/class_list.html +51 -0
  53. data/docs/css/common.css +1 -0
  54. data/docs/css/full_list.css +58 -0
  55. data/docs/css/style.css +496 -0
  56. data/docs/file.COPYING.html +81 -0
  57. data/docs/file.MIT-LICENSE.html +85 -0
  58. data/docs/file.README.html +429 -0
  59. data/docs/file.RELEASE.html +942 -0
  60. data/docs/file_list.html +71 -0
  61. data/docs/frames.html +17 -0
  62. data/docs/index.html +429 -0
  63. data/docs/js/app.js +303 -0
  64. data/docs/js/full_list.js +216 -0
  65. data/docs/js/jquery.js +4 -0
  66. data/docs/method_list.html +635 -0
  67. data/docs/top-level-namespace.html +118 -0
  68. data/gemfiles/Gemfile.minitest.5.11.3 +7 -0
  69. data/gemfiles/Gemfile.test-unit.latest +5 -1
  70. data/init.rb +1 -3
  71. data/lib/mocha.rb +8 -0
  72. data/lib/mocha/any_instance_method.rb +12 -50
  73. data/lib/mocha/api.rb +63 -65
  74. data/lib/mocha/argument_iterator.rb +4 -8
  75. data/lib/mocha/backtrace_filter.rb +1 -5
  76. data/lib/mocha/cardinality.rb +43 -35
  77. data/lib/mocha/central.rb +21 -12
  78. data/lib/mocha/change_state_side_effect.rb +0 -4
  79. data/lib/mocha/class_methods.rb +18 -20
  80. data/lib/mocha/configuration.rb +305 -18
  81. data/lib/mocha/debug.rb +3 -2
  82. data/lib/mocha/deprecation.rb +6 -10
  83. data/lib/mocha/detection/mini_test.rb +0 -2
  84. data/lib/mocha/detection/test_unit.rb +3 -5
  85. data/lib/mocha/error_with_filtered_backtrace.rb +13 -0
  86. data/lib/mocha/exception_raiser.rb +4 -6
  87. data/lib/mocha/expectation.rb +62 -67
  88. data/lib/mocha/expectation_error.rb +1 -1
  89. data/lib/mocha/expectation_error_factory.rb +0 -1
  90. data/lib/mocha/expectation_list.rb +7 -11
  91. data/lib/mocha/hooks.rb +1 -3
  92. data/lib/mocha/in_state_ordering_constraint.rb +0 -4
  93. data/lib/mocha/inspect.rb +28 -38
  94. data/lib/mocha/instance_method.rb +15 -8
  95. data/lib/mocha/integration.rb +2 -5
  96. data/lib/mocha/integration/mini_test.rb +7 -0
  97. data/lib/mocha/integration/mini_test/adapter.rb +2 -4
  98. data/lib/mocha/integration/mini_test/exception_translation.rb +1 -1
  99. data/lib/mocha/integration/mini_test/nothing.rb +4 -4
  100. data/lib/mocha/integration/mini_test/version_13.rb +4 -1
  101. data/lib/mocha/integration/mini_test/version_140.rb +4 -1
  102. data/lib/mocha/integration/mini_test/version_141.rb +4 -1
  103. data/lib/mocha/integration/mini_test/version_142_to_172.rb +4 -1
  104. data/lib/mocha/integration/mini_test/version_200.rb +4 -1
  105. data/lib/mocha/integration/mini_test/version_201_to_222.rb +4 -1
  106. data/lib/mocha/integration/mini_test/version_2110_to_2111.rb +4 -1
  107. data/lib/mocha/integration/mini_test/version_2112_to_320.rb +4 -1
  108. data/lib/mocha/integration/mini_test/version_230_to_2101.rb +4 -1
  109. data/lib/mocha/integration/monkey_patcher.rb +8 -2
  110. data/lib/mocha/integration/test_unit.rb +7 -0
  111. data/lib/mocha/integration/test_unit/adapter.rb +5 -6
  112. data/lib/mocha/integration/test_unit/gem_version_200.rb +5 -2
  113. data/lib/mocha/integration/test_unit/gem_version_201_to_202.rb +5 -2
  114. data/lib/mocha/integration/test_unit/gem_version_203_to_220.rb +5 -2
  115. data/lib/mocha/integration/test_unit/gem_version_230_to_250.rb +5 -2
  116. data/lib/mocha/integration/test_unit/nothing.rb +4 -4
  117. data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +4 -1
  118. data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +4 -1
  119. data/lib/mocha/invocation.rb +61 -0
  120. data/lib/mocha/is_a.rb +0 -2
  121. data/lib/mocha/logger.rb +0 -4
  122. data/lib/mocha/macos_version.rb +5 -0
  123. data/lib/mocha/method_matcher.rb +1 -5
  124. data/lib/mocha/minitest.rb +8 -0
  125. data/lib/mocha/mock.rb +70 -44
  126. data/lib/mocha/mockery.rb +78 -91
  127. data/lib/mocha/multiple_yields.rb +0 -5
  128. data/lib/mocha/names.rb +2 -12
  129. data/lib/mocha/no_yields.rb +1 -7
  130. data/lib/mocha/not_initialized_error.rb +7 -0
  131. data/lib/mocha/object_methods.rb +27 -33
  132. data/lib/mocha/parameter_matchers.rb +2 -4
  133. data/lib/mocha/parameter_matchers/all_of.rb +2 -8
  134. data/lib/mocha/parameter_matchers/any_of.rb +2 -8
  135. data/lib/mocha/parameter_matchers/any_parameters.rb +3 -9
  136. data/lib/mocha/parameter_matchers/anything.rb +2 -8
  137. data/lib/mocha/parameter_matchers/base.rb +6 -12
  138. data/lib/mocha/parameter_matchers/equals.rb +1 -7
  139. data/lib/mocha/parameter_matchers/{query_string.rb → equivalent_uri.rb} +15 -15
  140. data/lib/mocha/parameter_matchers/has_entries.rb +2 -6
  141. data/lib/mocha/parameter_matchers/has_entry.rb +8 -11
  142. data/lib/mocha/parameter_matchers/has_key.rb +2 -6
  143. data/lib/mocha/parameter_matchers/has_value.rb +2 -6
  144. data/lib/mocha/parameter_matchers/includes.rb +50 -8
  145. data/lib/mocha/parameter_matchers/instance_methods.rb +18 -0
  146. data/lib/mocha/parameter_matchers/instance_of.rb +0 -6
  147. data/lib/mocha/parameter_matchers/is_a.rb +2 -6
  148. data/lib/mocha/parameter_matchers/kind_of.rb +2 -6
  149. data/lib/mocha/parameter_matchers/not.rb +2 -6
  150. data/lib/mocha/parameter_matchers/optionally.rb +4 -10
  151. data/lib/mocha/parameter_matchers/regexp_matches.rb +0 -6
  152. data/lib/mocha/parameter_matchers/responds_with.rb +3 -8
  153. data/lib/mocha/parameter_matchers/yaml_equivalent.rb +2 -6
  154. data/lib/mocha/parameters_matcher.rb +6 -9
  155. data/lib/mocha/pretty_parameters.rb +0 -4
  156. data/lib/mocha/raised_exception.rb +11 -0
  157. data/lib/mocha/receivers.rb +10 -14
  158. data/lib/mocha/return_values.rb +4 -8
  159. data/lib/mocha/ruby_version.rb +4 -0
  160. data/lib/mocha/sequence.rb +4 -9
  161. data/lib/mocha/setup.rb +5 -0
  162. data/lib/mocha/single_return_value.rb +2 -5
  163. data/lib/mocha/single_yield.rb +0 -5
  164. data/lib/mocha/singleton_class.rb +9 -0
  165. data/lib/mocha/state_machine.rb +6 -10
  166. data/lib/mocha/stubbed_method.rb +127 -0
  167. data/lib/mocha/stubbing_error.rb +2 -13
  168. data/lib/mocha/test_unit.rb +7 -2
  169. data/lib/mocha/thrower.rb +4 -6
  170. data/lib/mocha/thrown_object.rb +12 -0
  171. data/lib/mocha/version.rb +1 -1
  172. data/lib/mocha/yield_parameters.rb +3 -7
  173. data/mocha.gemspec +35 -39
  174. data/test/acceptance/acceptance_test_helper.rb +6 -6
  175. data/test/acceptance/bug_18914_test.rb +7 -13
  176. data/test/acceptance/bug_21465_test.rb +0 -3
  177. data/test/acceptance/bug_21563_test.rb +0 -3
  178. data/test/acceptance/display_matching_invocations_alongside_expectations_test.rb +69 -0
  179. data/test/acceptance/exception_rescue_test.rb +7 -9
  180. data/test/acceptance/expectations_on_multiple_methods_test.rb +2 -2
  181. data/test/acceptance/expected_invocation_count_test.rb +27 -30
  182. data/test/acceptance/failure_messages_test.rb +3 -6
  183. data/test/acceptance/issue_272_test.rb +50 -0
  184. data/test/acceptance/issue_65_test.rb +15 -14
  185. data/test/acceptance/issue_70_test.rb +0 -2
  186. data/test/acceptance/mocha_example_test.rb +5 -7
  187. data/test/acceptance/mocha_test_result_test.rb +7 -8
  188. data/test/acceptance/mock_test.rb +48 -9
  189. data/test/acceptance/mocked_methods_dispatch_test.rb +0 -3
  190. data/test/acceptance/multiple_expectations_failure_message_test.rb +16 -18
  191. data/test/acceptance/optional_parameters_test.rb +0 -3
  192. data/test/acceptance/parameter_matcher_test.rb +6 -44
  193. data/test/acceptance/partial_mocks_test.rb +4 -7
  194. data/test/acceptance/prepend_test.rb +86 -0
  195. data/test/acceptance/prevent_use_of_mocha_outside_test_test.rb +76 -0
  196. data/test/acceptance/raise_exception_test.rb +2 -5
  197. data/test/acceptance/return_value_test.rb +0 -3
  198. data/test/acceptance/sequence_test.rb +9 -12
  199. data/test/acceptance/states_test.rb +6 -5
  200. data/test/acceptance/stub_any_instance_method_defined_on_superclass_test.rb +33 -3
  201. data/test/acceptance/stub_any_instance_method_test.rb +119 -21
  202. data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +8 -9
  203. data/test/acceptance/stub_class_method_defined_on_class_test.rb +5 -5
  204. data/test/acceptance/stub_class_method_defined_on_module_test.rb +0 -2
  205. data/test/acceptance/stub_class_method_defined_on_superclass_test.rb +34 -2
  206. data/test/acceptance/stub_everything_test.rb +1 -4
  207. data/test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb +6 -8
  208. data/test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb +0 -2
  209. data/test/acceptance/stub_instance_method_defined_on_class_test.rb +3 -5
  210. data/test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb +63 -2
  211. data/test/acceptance/stub_instance_method_defined_on_module_test.rb +3 -2
  212. data/test/acceptance/stub_instance_method_defined_on_object_class_test.rb +2 -2
  213. data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +0 -3
  214. data/test/acceptance/stub_instance_method_defined_on_superclass_test.rb +0 -2
  215. data/test/acceptance/stub_method_defined_on_module_and_aliased_test.rb +38 -0
  216. data/test/acceptance/stub_module_method_test.rb +58 -21
  217. data/test/acceptance/stub_test.rb +1 -4
  218. data/test/acceptance/stubba_example_test.rb +6 -15
  219. data/test/acceptance/stubba_test_result_test.rb +11 -6
  220. data/test/acceptance/stubbing_error_backtrace_test.rb +6 -7
  221. data/test/acceptance/stubbing_frozen_object_test.rb +2 -2
  222. data/test/acceptance/stubbing_method_accepting_block_parameter_test.rb +12 -8
  223. data/test/acceptance/stubbing_method_unnecessarily_test.rb +5 -7
  224. data/test/acceptance/stubbing_nil_test.rb +36 -35
  225. data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +23 -12
  226. data/test/acceptance/stubbing_non_existent_class_method_test.rb +14 -14
  227. data/test/acceptance/stubbing_non_existent_instance_method_test.rb +12 -14
  228. data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +8 -10
  229. data/test/acceptance/stubbing_non_public_class_method_test.rb +12 -12
  230. data/test/acceptance/stubbing_non_public_instance_method_test.rb +10 -12
  231. data/test/acceptance/stubbing_on_non_mock_object_test.rb +17 -11
  232. data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +3 -5
  233. data/test/acceptance/throw_test.rb +0 -3
  234. data/test/acceptance/unexpected_invocation_test.rb +2 -4
  235. data/test/acceptance/unstubbing_test.rb +41 -15
  236. data/test/assertions.rb +6 -4
  237. data/test/deprecation_disabler.rb +1 -1
  238. data/test/execution_point.rb +7 -7
  239. data/test/integration/mini_test_test.rb +2 -2
  240. data/test/integration/shared_tests.rb +27 -23
  241. data/test/integration/test_unit_test.rb +2 -2
  242. data/test/method_definer.rb +11 -19
  243. data/test/mini_test_result.rb +17 -11
  244. data/test/minitest_result.rb +2 -3
  245. data/test/simple_counter.rb +0 -2
  246. data/test/test_helper.rb +13 -5
  247. data/test/test_runner.rb +5 -5
  248. data/test/test_unit_result.rb +4 -2
  249. data/test/unit/any_instance_method_test.rb +74 -31
  250. data/test/unit/array_inspect_test.rb +2 -4
  251. data/test/unit/backtrace_filter_test.rb +3 -5
  252. data/test/unit/cardinality_test.rb +41 -25
  253. data/test/unit/central_test.rb +26 -28
  254. data/test/unit/change_state_side_effect_test.rb +0 -4
  255. data/test/unit/class_methods_test.rb +35 -6
  256. data/test/unit/configuration_test.rb +13 -14
  257. data/test/unit/date_time_inspect_test.rb +1 -3
  258. data/test/unit/exception_raiser_test.rb +10 -7
  259. data/test/unit/expectation_list_test.rb +13 -13
  260. data/test/unit/expectation_test.rb +111 -131
  261. data/test/unit/hash_inspect_test.rb +3 -5
  262. data/test/unit/hooks_test.rb +14 -8
  263. data/test/unit/in_state_ordering_constraint_test.rb +0 -4
  264. data/test/unit/instance_method_test.rb +282 -0
  265. data/test/unit/method_matcher_test.rb +1 -3
  266. data/test/unit/mock_test.rb +56 -25
  267. data/test/unit/mockery_test.rb +49 -29
  268. data/test/unit/module_methods_test.rb +2 -5
  269. data/test/unit/multiple_yields_test.rb +0 -2
  270. data/test/unit/no_yields_test.rb +0 -2
  271. data/test/unit/object_inspect_test.rb +27 -5
  272. data/test/unit/object_methods_test.rb +25 -8
  273. data/test/unit/parameter_matchers/all_of_test.rb +0 -2
  274. data/test/unit/parameter_matchers/any_of_test.rb +0 -2
  275. data/test/unit/parameter_matchers/anything_test.rb +2 -4
  276. data/test/unit/parameter_matchers/equals_test.rb +1 -3
  277. data/test/unit/parameter_matchers/equivalent_uri_test.rb +41 -0
  278. data/test/unit/parameter_matchers/has_entries_test.rb +3 -3
  279. data/test/unit/parameter_matchers/has_entry_test.rb +16 -17
  280. data/test/unit/parameter_matchers/has_key_test.rb +1 -2
  281. data/test/unit/parameter_matchers/has_value_test.rb +2 -4
  282. data/test/unit/parameter_matchers/includes_test.rb +50 -3
  283. data/test/unit/parameter_matchers/instance_of_test.rb +1 -3
  284. data/test/unit/parameter_matchers/is_a_test.rb +1 -3
  285. data/test/unit/parameter_matchers/kind_of_test.rb +1 -3
  286. data/test/unit/parameter_matchers/not_test.rb +0 -2
  287. data/test/unit/parameter_matchers/regexp_matches_test.rb +1 -2
  288. data/test/unit/parameter_matchers/responds_with_test.rb +10 -4
  289. data/test/unit/parameter_matchers/stub_matcher.rb +0 -4
  290. data/test/unit/parameter_matchers/yaml_equivalent_test.rb +1 -3
  291. data/test/unit/parameters_matcher_test.rb +2 -4
  292. data/test/unit/receivers_test.rb +35 -5
  293. data/test/unit/return_values_test.rb +28 -25
  294. data/test/unit/sequence_test.rb +1 -5
  295. data/test/unit/single_return_value_test.rb +6 -3
  296. data/test/unit/single_yield_test.rb +0 -2
  297. data/test/unit/state_machine_test.rb +1 -3
  298. data/test/unit/string_inspect_test.rb +3 -5
  299. data/test/unit/thrower_test.rb +7 -4
  300. data/test/unit/yield_parameters_test.rb +0 -2
  301. data/yard-templates/default/layout/html/google_analytics.erb +6 -9
  302. data/yard-templates/default/layout/html/setup.rb +2 -3
  303. metadata +99 -42
  304. data/lib/mocha/class_method.rb +0 -106
  305. data/lib/mocha/mini_test.rb +0 -3
  306. data/lib/mocha/module_method.rb +0 -16
  307. data/lib/mocha/module_methods.rb +0 -14
  308. data/lib/mocha/parameter_matchers/object.rb +0 -17
  309. data/lib/mocha/standalone.rb +0 -4
  310. data/lib/mocha/unexpected_invocation.rb +0 -26
  311. data/lib/mocha_standalone.rb +0 -4
  312. data/test/acceptance/mock_with_initializer_block_test.rb +0 -51
  313. data/test/unit/class_method_test.rb +0 -223
@@ -0,0 +1,339 @@
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::ClassMethods
8
+
9
+ &mdash; Mocha 1.10.0.alpha
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::ClassMethods";
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 (C)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span>
41
+ &raquo;
42
+ <span class="title">ClassMethods</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::ClassMethods
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/class_methods.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+ <h2>Overview</h2><div class="docstring">
87
+ <div class="discussion">
88
+
89
+ <p>Methods added to all classes to allow mocking and stubbing on real (i.e. non-mock) objects.</p>
90
+
91
+
92
+ </div>
93
+ </div>
94
+ <div class="tags">
95
+
96
+
97
+ </div>
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+ <h2>
106
+ Instance Method Summary
107
+ <small><a href="#" class="summary_toggle">collapse</a></small>
108
+ </h2>
109
+
110
+ <ul class="summary">
111
+
112
+ <li class="public ">
113
+ <span class="summary_signature">
114
+
115
+ <a href="#any_instance-instance_method" title="#any_instance (instance method)">#<strong>any_instance</strong> &#x21d2; Mock </a>
116
+
117
+
118
+
119
+ </span>
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+ <span class="summary_desc"><div class='inline'>
130
+ <p>A mock object which will detect calls to any instance of this class.</p>
131
+ </div></span>
132
+
133
+ </li>
134
+
135
+
136
+ <li class="public ">
137
+ <span class="summary_signature">
138
+
139
+ <a href="#method_visibility-instance_method" title="#method_visibility (instance method)">#<strong>method_visibility</strong>(method, include_public_methods = true) &#x21d2; Object </a>
140
+
141
+
142
+
143
+ (also: #method_exists?)
144
+
145
+ </span>
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+ <span class="summary_desc"><div class='inline'>
156
+ <p>rubocop:disable Metrics/CyclomaticComplexity.</p>
157
+ </div></span>
158
+
159
+ </li>
160
+
161
+
162
+ </ul>
163
+
164
+
165
+
166
+
167
+ <div id="instance_method_details" class="method_details_list">
168
+ <h2>Instance Method Details</h2>
169
+
170
+
171
+ <div class="method_details first">
172
+ <h3 class="signature first" id="any_instance-instance_method">
173
+
174
+ #<strong>any_instance</strong> &#x21d2; <tt><span class='object_link'><a href="Mock.html" title="Mocha::Mock (class)">Mock</a></span></tt>
175
+
176
+
177
+
178
+
179
+
180
+ </h3><div class="docstring">
181
+ <div class="discussion">
182
+
183
+ <p>Returns a mock object which will detect calls to any instance of this class.</p>
184
+
185
+
186
+ </div>
187
+ </div>
188
+ <div class="tags">
189
+
190
+ <div class="examples">
191
+ <p class="tag_title">Examples:</p>
192
+
193
+
194
+ <p class="example_title"><div class='inline'>
195
+ <p>Return false to invocation of <tt>Product#save</tt> for any instance of <code>Product</code>.</p>
196
+ </div></p>
197
+
198
+ <pre class="example code"><code><span class='const'>Product</span><span class='period'>.</span><span class='id identifier rubyid_any_instance'>any_instance</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:save</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='kw'>false</span><span class='rparen'>)</span>
199
+ <span class='id identifier rubyid_product_1'>product_1</span> <span class='op'>=</span> <span class='const'>Product</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
200
+ <span class='id identifier rubyid_assert_equal'>assert_equal</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_product_1'>product_1</span><span class='period'>.</span><span class='id identifier rubyid_save'>save</span>
201
+ <span class='id identifier rubyid_product_2'>product_2</span> <span class='op'>=</span> <span class='const'>Product</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
202
+ <span class='id identifier rubyid_assert_equal'>assert_equal</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_product_2'>product_2</span><span class='period'>.</span><span class='id identifier rubyid_save'>save</span></code></pre>
203
+
204
+ </div>
205
+
206
+ <p class="tag_title">Returns:</p>
207
+ <ul class="return">
208
+
209
+ <li>
210
+
211
+
212
+ <span class='type'>(<tt><span class='object_link'><a href="Mock.html" title="Mocha::Mock (class)">Mock</a></span></tt>)</span>
213
+
214
+
215
+
216
+ &mdash;
217
+ <div class='inline'>
218
+ <p>a mock object which will detect calls to any instance of this class.</p>
219
+ </div>
220
+
221
+ </li>
222
+
223
+ </ul>
224
+ <p class="tag_title">Raises:</p>
225
+ <ul class="raise">
226
+
227
+ <li>
228
+
229
+
230
+ <span class='type'>(<tt><span class='object_link'><a href="StubbingError.html" title="Mocha::StubbingError (class)">StubbingError</a></span></tt>)</span>
231
+
232
+
233
+
234
+ &mdash;
235
+ <div class='inline'>
236
+ <p>if attempting to stub method which is not allowed.</p>
237
+ </div>
238
+
239
+ </li>
240
+
241
+ </ul>
242
+
243
+ </div><table class="source_code">
244
+ <tr>
245
+ <td>
246
+ <pre class="lines">
247
+
248
+
249
+ 45
250
+ 46
251
+ 47
252
+ 48
253
+ 49
254
+ 50</pre>
255
+ </td>
256
+ <td>
257
+ <pre class="code"><span class="info file"># File 'lib/mocha/class_methods.rb', line 45</span>
258
+
259
+ <span class='kw'>def</span> <span class='id identifier rubyid_any_instance'>any_instance</span>
260
+ <span class='kw'>if</span> <span class='id identifier rubyid_frozen?'>frozen?</span>
261
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="StubbingError.html" title="Mocha::StubbingError (class)">StubbingError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>can&#39;t stub method on frozen object: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_mocha_inspect'>mocha_inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.any_instance</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_caller'>caller</span><span class='rparen'>)</span>
262
+ <span class='kw'>end</span>
263
+ <span class='ivar'>@any_instance</span> <span class='op'>||=</span> <span class='const'>AnyInstance</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
264
+ <span class='kw'>end</span></pre>
265
+ </td>
266
+ </tr>
267
+ </table>
268
+ </div>
269
+
270
+ <div class="method_details ">
271
+ <h3 class="signature " id="method_visibility-instance_method">
272
+
273
+ #<strong>method_visibility</strong>(method, include_public_methods = true) &#x21d2; <tt><span class='object_link'>Object</span></tt>
274
+
275
+
276
+
277
+ <span class="aliases">Also known as:
278
+ <span class="names"><span id='method_exists?-instance_method'>method_exists?</span></span>
279
+ </span>
280
+
281
+
282
+
283
+ </h3><div class="docstring">
284
+ <div class="discussion">
285
+
286
+ <p>rubocop:disable Metrics/CyclomaticComplexity</p>
287
+
288
+
289
+ </div>
290
+ </div>
291
+ <div class="tags">
292
+
293
+
294
+ </div><table class="source_code">
295
+ <tr>
296
+ <td>
297
+ <pre class="lines">
298
+
299
+
300
+ 53
301
+ 54
302
+ 55
303
+ 56
304
+ 57</pre>
305
+ </td>
306
+ <td>
307
+ <pre class="code"><span class="info file"># File 'lib/mocha/class_methods.rb', line 53</span>
308
+
309
+ <span class='kw'>def</span> <span class='id identifier rubyid_method_visibility'>method_visibility</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_include_public_methods'>include_public_methods</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
310
+ <span class='lparen'>(</span><span class='id identifier rubyid_include_public_methods'>include_public_methods</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_public_method_defined?'>public_method_defined?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='symbol'>:public</span><span class='rparen'>)</span> <span class='op'>||</span>
311
+ <span class='lparen'>(</span><span class='id identifier rubyid_protected_method_defined?'>protected_method_defined?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='symbol'>:protected</span><span class='rparen'>)</span> <span class='op'>||</span>
312
+ <span class='lparen'>(</span><span class='id identifier rubyid_private_method_defined?'>private_method_defined?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='symbol'>:private</span><span class='rparen'>)</span>
313
+ <span class='kw'>end</span></pre>
314
+ </td>
315
+ </tr>
316
+ </table>
317
+ </div>
318
+
319
+ </div>
320
+
321
+ <script async src="https://www.googletagmanager.com/gtag/js?id=UA-625523-7"></script>
322
+ <script>
323
+ window.dataLayer = window.dataLayer || [];
324
+ function gtag(){dataLayer.push(arguments);}
325
+ gtag('js', new Date());
326
+
327
+ gtag('config', 'UA-625523-7');
328
+ </script>
329
+ </div>
330
+
331
+ <div id="footer">
332
+ Generated on Sun Nov 24 15:26:49 2019 by
333
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
334
+ 0.9.20 (ruby-2.6.5).
335
+ </div>
336
+
337
+ </div>
338
+ </body>
339
+ </html>
@@ -0,0 +1,1383 @@
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
+ Class: Mocha::Configuration
8
+
9
+ &mdash; Mocha 1.10.0.alpha
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::Configuration";
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 (C)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span>
41
+ &raquo;
42
+ <span class="title">Configuration</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>Class: Mocha::Configuration
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName"><span class='object_link'>Object</span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li><span class='object_link'>Object</span></li>
76
+
77
+ <li class="next">Mocha::Configuration</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/mocha/configuration.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>This class provides a number of ways to configure the library.</p>
106
+
107
+ <p>Typically the configuration is set globally in a <code>test_helper.rb</code> or <code>spec_helper.rb</code> file.</p>
108
+
109
+
110
+ </div>
111
+ </div>
112
+ <div class="tags">
113
+
114
+ <div class="examples">
115
+ <p class="tag_title">Examples:</p>
116
+
117
+
118
+ <p class="example_title"><div class='inline'>
119
+ <p>Setting multiple configuration options</p>
120
+ </div></p>
121
+
122
+ <pre class="example code"><code><span class='const'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span><span class='period'>.</span><span class='id identifier rubyid_configure'><span class='object_link'><a href="../Mocha.html#configure-class_method" title="Mocha.configure (method)">configure</a></span></span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span>
123
+ <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>
124
+ <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>
125
+ <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>
126
+ <span class='kw'>end</span></code></pre>
127
+
128
+ </div>
129
+
130
+
131
+ </div>
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+ <h2>
140
+ Class Method Summary
141
+ <small><a href="#" class="summary_toggle">collapse</a></small>
142
+ </h2>
143
+
144
+ <ul class="summary">
145
+
146
+ <li class="public deprecated">
147
+ <span class="summary_signature">
148
+
149
+ <a href="#allow-class_method" title="allow (class method)">.<strong>allow</strong>(action) { ... } &#x21d2; Object </a>
150
+
151
+
152
+
153
+ </span>
154
+
155
+
156
+
157
+
158
+
159
+ <span class="deprecated note title">deprecated</span>
160
+
161
+
162
+
163
+ <span class="summary_desc"><strong>Deprecated.</strong> <div class='inline'>
164
+ <p>If a block is supplied, call <span class='object_link'><a href="#override-class_method" title="Mocha::Configuration.override (method)">Configuration.override</a></span> with a <code>Hash</code> containing an entry with the <code>action</code> as the key and <code>:allow</code> as the value. If no block is supplied, call the appropriate <code>action</code> writer method with <code>value</code> set to <code>:allow</code> via <span class='object_link'><a href="../Mocha.html#configure-class_method" title="Mocha.configure (method)">configure</a></span>. The writer method will be the one of the following corresponding to the <code>action</code>:</p>
165
+ <ul><li>
166
+ <p><span class='object_link'><a href="#stubbing_method_unnecessarily=-instance_method" title="Mocha::Configuration#stubbing_method_unnecessarily= (method)">#stubbing_method_unnecessarily=</a></span></p>
167
+ </li><li>
168
+ <p><span class='object_link'><a href="#stubbing_method_on_non_mock_object=-instance_method" title="Mocha::Configuration#stubbing_method_on_non_mock_object= (method)">#stubbing_method_on_non_mock_object=</a></span></p>
169
+ </li><li>
170
+ <p><span class='object_link'><a href="#stubbing_non_existent_method=-instance_method" title="Mocha::Configuration#stubbing_non_existent_method= (method)">#stubbing_non_existent_method=</a></span></p>
171
+ </li><li>
172
+ <p><span class='object_link'><a href="#stubbing_non_public_method=-instance_method" title="Mocha::Configuration#stubbing_non_public_method= (method)">#stubbing_non_public_method=</a></span></p>
173
+ </li><li>
174
+ <p><span class='object_link'><a href="#stubbing_method_on_nil=-instance_method" title="Mocha::Configuration#stubbing_method_on_nil= (method)">#stubbing_method_on_nil=</a></span></p>
175
+ </li></ul>
176
+ </div></span>
177
+
178
+ </li>
179
+
180
+
181
+ <li class="public ">
182
+ <span class="summary_signature">
183
+
184
+ <a href="#override-class_method" title="override (class method)">.<strong>override</strong>(temporary_options) { ... } &#x21d2; Object </a>
185
+
186
+
187
+
188
+ </span>
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+ <span class="summary_desc"><div class='inline'>
199
+ <p>Temporarily modify <span class='object_link'><a href="" title="Mocha::Configuration (class)">Configuration</a></span> options.</p>
200
+ </div></span>
201
+
202
+ </li>
203
+
204
+
205
+ <li class="public deprecated">
206
+ <span class="summary_signature">
207
+
208
+ <a href="#prevent-class_method" title="prevent (class method)">.<strong>prevent</strong>(action) { ... } &#x21d2; Object </a>
209
+
210
+
211
+
212
+ </span>
213
+
214
+
215
+
216
+
217
+
218
+ <span class="deprecated note title">deprecated</span>
219
+
220
+
221
+
222
+ <span class="summary_desc"><strong>Deprecated.</strong> <div class='inline'>
223
+ <p>If a block is supplied, call <span class='object_link'><a href="#override-class_method" title="Mocha::Configuration.override (method)">Configuration.override</a></span> with a <code>Hash</code> containing an entry with the <code>action</code> as the key and <code>:prevent</code> as the value. If no block is supplied, call the appropriate <code>action</code> writer method with <code>value</code> set to <code>:prevent</code> via <span class='object_link'><a href="../Mocha.html#configure-class_method" title="Mocha.configure (method)">configure</a></span>. The writer method will be the one of the following corresponding to the <code>action</code>:</p>
224
+ <ul><li>
225
+ <p><span class='object_link'><a href="#stubbing_method_unnecessarily=-instance_method" title="Mocha::Configuration#stubbing_method_unnecessarily= (method)">#stubbing_method_unnecessarily=</a></span></p>
226
+ </li><li>
227
+ <p><span class='object_link'><a href="#stubbing_method_on_non_mock_object=-instance_method" title="Mocha::Configuration#stubbing_method_on_non_mock_object= (method)">#stubbing_method_on_non_mock_object=</a></span></p>
228
+ </li><li>
229
+ <p><span class='object_link'><a href="#stubbing_non_existent_method=-instance_method" title="Mocha::Configuration#stubbing_non_existent_method= (method)">#stubbing_non_existent_method=</a></span></p>
230
+ </li><li>
231
+ <p><span class='object_link'><a href="#stubbing_non_public_method=-instance_method" title="Mocha::Configuration#stubbing_non_public_method= (method)">#stubbing_non_public_method=</a></span></p>
232
+ </li><li>
233
+ <p><span class='object_link'><a href="#stubbing_method_on_nil=-instance_method" title="Mocha::Configuration#stubbing_method_on_nil= (method)">#stubbing_method_on_nil=</a></span></p>
234
+ </li></ul>
235
+ </div></span>
236
+
237
+ </li>
238
+
239
+
240
+ <li class="public deprecated">
241
+ <span class="summary_signature">
242
+
243
+ <a href="#warn_when-class_method" title="warn_when (class method)">.<strong>warn_when</strong>(action) { ... } &#x21d2; Object </a>
244
+
245
+
246
+
247
+ </span>
248
+
249
+
250
+
251
+
252
+
253
+ <span class="deprecated note title">deprecated</span>
254
+
255
+
256
+
257
+ <span class="summary_desc"><strong>Deprecated.</strong> <div class='inline'>
258
+ <p>If a block is supplied, call <span class='object_link'><a href="#override-class_method" title="Mocha::Configuration.override (method)">Configuration.override</a></span> with a <code>Hash</code> containing an entry with the <code>action</code> as the key and <code>:warn</code> as the value. If no block is supplied, call the appropriate <code>action</code> writer method with <code>value</code> set to <code>:warn</code> via <span class='object_link'><a href="../Mocha.html#configure-class_method" title="Mocha.configure (method)">configure</a></span>. The writer method will be the one of the following corresponding to the <code>action</code>:</p>
259
+ <ul><li>
260
+ <p><span class='object_link'><a href="#stubbing_method_unnecessarily=-instance_method" title="Mocha::Configuration#stubbing_method_unnecessarily= (method)">#stubbing_method_unnecessarily=</a></span></p>
261
+ </li><li>
262
+ <p><span class='object_link'><a href="#stubbing_method_on_non_mock_object=-instance_method" title="Mocha::Configuration#stubbing_method_on_non_mock_object= (method)">#stubbing_method_on_non_mock_object=</a></span></p>
263
+ </li><li>
264
+ <p><span class='object_link'><a href="#stubbing_non_existent_method=-instance_method" title="Mocha::Configuration#stubbing_non_existent_method= (method)">#stubbing_non_existent_method=</a></span></p>
265
+ </li><li>
266
+ <p><span class='object_link'><a href="#stubbing_non_public_method=-instance_method" title="Mocha::Configuration#stubbing_non_public_method= (method)">#stubbing_non_public_method=</a></span></p>
267
+ </li><li>
268
+ <p><span class='object_link'><a href="#stubbing_method_on_nil=-instance_method" title="Mocha::Configuration#stubbing_method_on_nil= (method)">#stubbing_method_on_nil=</a></span></p>
269
+ </li></ul>
270
+ </div></span>
271
+
272
+ </li>
273
+
274
+
275
+ </ul>
276
+
277
+ <h2>
278
+ Instance Method Summary
279
+ <small><a href="#" class="summary_toggle">collapse</a></small>
280
+ </h2>
281
+
282
+ <ul class="summary">
283
+
284
+ <li class="public ">
285
+ <span class="summary_signature">
286
+
287
+ <a href="#display_matching_invocations_on_failure=-instance_method" title="#display_matching_invocations_on_failure= (instance method)">#<strong>display_matching_invocations_on_failure=</strong>(value) &#x21d2; Object </a>
288
+
289
+
290
+
291
+ </span>
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+ <span class="summary_desc"><div class='inline'>
302
+ <p>Display matching invocations alongside expectations on Mocha-related test failure.</p>
303
+ </div></span>
304
+
305
+ </li>
306
+
307
+
308
+ <li class="public ">
309
+ <span class="summary_signature">
310
+
311
+ <a href="#stubbing_method_on_nil=-instance_method" title="#stubbing_method_on_nil= (instance method)">#<strong>stubbing_method_on_nil=</strong>(value) &#x21d2; Object </a>
312
+
313
+
314
+
315
+ </span>
316
+
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+ <span class="summary_desc"><div class='inline'>
326
+ <p>Configure whether stubbing methods on the <code>nil</code> object is allowed.</p>
327
+ </div></span>
328
+
329
+ </li>
330
+
331
+
332
+ <li class="public ">
333
+ <span class="summary_signature">
334
+
335
+ <a href="#stubbing_method_on_non_mock_object=-instance_method" title="#stubbing_method_on_non_mock_object= (instance method)">#<strong>stubbing_method_on_non_mock_object=</strong>(value) &#x21d2; Object </a>
336
+
337
+
338
+
339
+ </span>
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+ <span class="summary_desc"><div class='inline'>
350
+ <p>Configure whether stubbing methods on non-mock objects is allowed.</p>
351
+ </div></span>
352
+
353
+ </li>
354
+
355
+
356
+ <li class="public ">
357
+ <span class="summary_signature">
358
+
359
+ <a href="#stubbing_method_unnecessarily=-instance_method" title="#stubbing_method_unnecessarily= (instance method)">#<strong>stubbing_method_unnecessarily=</strong>(value) &#x21d2; Object </a>
360
+
361
+
362
+
363
+ </span>
364
+
365
+
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+ <span class="summary_desc"><div class='inline'>
374
+ <p>Configure whether stubbing methods unnecessarily is allowed.</p>
375
+ </div></span>
376
+
377
+ </li>
378
+
379
+
380
+ <li class="public ">
381
+ <span class="summary_signature">
382
+
383
+ <a href="#stubbing_non_existent_method=-instance_method" title="#stubbing_non_existent_method= (instance method)">#<strong>stubbing_non_existent_method=</strong>(value) &#x21d2; Object </a>
384
+
385
+
386
+
387
+ </span>
388
+
389
+
390
+
391
+
392
+
393
+
394
+
395
+
396
+
397
+ <span class="summary_desc"><div class='inline'>
398
+ <p>Configure whether stubbing of non-existent methods is allowed.</p>
399
+ </div></span>
400
+
401
+ </li>
402
+
403
+
404
+ <li class="public ">
405
+ <span class="summary_signature">
406
+
407
+ <a href="#stubbing_non_public_method=-instance_method" title="#stubbing_non_public_method= (instance method)">#<strong>stubbing_non_public_method=</strong>(value) &#x21d2; Object </a>
408
+
409
+
410
+
411
+ </span>
412
+
413
+
414
+
415
+
416
+
417
+
418
+
419
+
420
+
421
+ <span class="summary_desc"><div class='inline'>
422
+ <p>Configure whether stubbing of non-public methods is allowed.</p>
423
+ </div></span>
424
+
425
+ </li>
426
+
427
+
428
+ </ul>
429
+
430
+
431
+
432
+
433
+ <div id="class_method_details" class="method_details_list">
434
+ <h2>Class Method Details</h2>
435
+
436
+
437
+ <div class="method_details first">
438
+ <h3 class="signature first" id="allow-class_method">
439
+
440
+ .<strong>allow</strong>(action) { ... } &#x21d2; <tt><span class='object_link'>Object</span></tt>
441
+
442
+
443
+
444
+
445
+
446
+ </h3><div class="docstring">
447
+ <div class="discussion">
448
+ <div class="note deprecated"><strong>Deprecated.</strong> <div class='inline'>
449
+ <p>If a block is supplied, call <span class='object_link'><a href="#override-class_method" title="Mocha::Configuration.override (method)">override</a></span> with a <code>Hash</code> containing an entry with the <code>action</code> as the key and <code>:allow</code> as the value. If no block is supplied, call the appropriate <code>action</code> writer method with <code>value</code> set to <code>:allow</code> via <span class='object_link'><a href="../Mocha.html#configure-class_method" title="Mocha.configure (method)">Mocha.configure</a></span>. The writer method will be the one of the following corresponding to the <code>action</code>:</p>
450
+ <ul><li>
451
+ <p><span class='object_link'><a href="#stubbing_method_unnecessarily=-instance_method" title="Mocha::Configuration#stubbing_method_unnecessarily= (method)">#stubbing_method_unnecessarily=</a></span></p>
452
+ </li><li>
453
+ <p><span class='object_link'><a href="#stubbing_method_on_non_mock_object=-instance_method" title="Mocha::Configuration#stubbing_method_on_non_mock_object= (method)">#stubbing_method_on_non_mock_object=</a></span></p>
454
+ </li><li>
455
+ <p><span class='object_link'><a href="#stubbing_non_existent_method=-instance_method" title="Mocha::Configuration#stubbing_non_existent_method= (method)">#stubbing_non_existent_method=</a></span></p>
456
+ </li><li>
457
+ <p><span class='object_link'><a href="#stubbing_non_public_method=-instance_method" title="Mocha::Configuration#stubbing_non_public_method= (method)">#stubbing_non_public_method=</a></span></p>
458
+ </li><li>
459
+ <p><span class='object_link'><a href="#stubbing_method_on_nil=-instance_method" title="Mocha::Configuration#stubbing_method_on_nil= (method)">#stubbing_method_on_nil=</a></span></p>
460
+ </li></ul>
461
+ </div></div>
462
+
463
+ <p>Allow the specified <code>action</code>.</p>
464
+
465
+
466
+ </div>
467
+ </div>
468
+ <div class="tags">
469
+ <p class="tag_title">Parameters:</p>
470
+ <ul class="param">
471
+
472
+ <li>
473
+
474
+ <span class='name'>action</span>
475
+
476
+
477
+ <span class='type'>(<tt>Symbol</tt>)</span>
478
+
479
+
480
+
481
+ &mdash;
482
+ <div class='inline'>
483
+ <p>one of <code>:stubbing_method_unnecessarily</code>, <code>:stubbing_method_on_non_mock_object</code>, <code>:stubbing_non_existent_method</code>, <code>:stubbing_non_public_method</code>, <code>:stubbing_method_on_nil</code>.</p>
484
+ </div>
485
+
486
+ </li>
487
+
488
+ </ul>
489
+
490
+ <p class="tag_title">Yields:</p>
491
+ <ul class="yield">
492
+
493
+ <li>
494
+
495
+
496
+ <span class='type'></span>
497
+
498
+
499
+
500
+
501
+ <div class='inline'>
502
+ <p>optional block during which the configuration change will be changed before being returned to its original value at the end of the block.</p>
503
+ </div>
504
+
505
+ </li>
506
+
507
+ </ul>
508
+
509
+ </div><table class="source_code">
510
+ <tr>
511
+ <td>
512
+ <pre class="lines">
513
+
514
+
515
+ 261
516
+ 262
517
+ 263
518
+ 264
519
+ 265
520
+ 266
521
+ 267
522
+ 268</pre>
523
+ </td>
524
+ <td>
525
+ <pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 261</span>
526
+
527
+ <span class='kw'>def</span> <span class='id identifier rubyid_allow'>allow</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
528
+ <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
529
+ <span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Use Mocha::Configuration.override(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_action'>action</span><span class='embexpr_end'>}</span><span class='tstring_content'>: :allow) with the same block</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
530
+ <span class='kw'>else</span>
531
+ <span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Use Mocha.configure { |c| c.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_action'>action</span><span class='embexpr_end'>}</span><span class='tstring_content'> = :allow }</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
532
+ <span class='kw'>end</span>
533
+ <span class='id identifier rubyid_change_config'>change_config</span> <span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='symbol'>:allow</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span>
534
+ <span class='kw'>end</span></pre>
535
+ </td>
536
+ </tr>
537
+ </table>
538
+ </div>
539
+
540
+ <div class="method_details ">
541
+ <h3 class="signature " id="override-class_method">
542
+
543
+ .<strong>override</strong>(temporary_options) { ... } &#x21d2; <tt><span class='object_link'>Object</span></tt>
544
+
545
+
546
+
547
+
548
+
549
+ </h3><div class="docstring">
550
+ <div class="discussion">
551
+
552
+ <p>Temporarily modify <span class='object_link'><a href="" title="Mocha::Configuration (class)">Mocha::Configuration</a></span> options.</p>
553
+
554
+ <p>The supplied <code>temporary_options</code> will override the current configuration for the duration of the supplied block. The configuration will be returned to its original state when the block returns.</p>
555
+
556
+
557
+ </div>
558
+ </div>
559
+ <div class="tags">
560
+
561
+ <div class="examples">
562
+ <p class="tag_title">Examples:</p>
563
+
564
+
565
+ <p class="example_title"><div class='inline'>
566
+ <p>Temporarily allow stubbing of <code>nil</code></p>
567
+ </div></p>
568
+
569
+ <pre class="example code"><code><span class='const'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="Mocha::Configuration (class)">Configuration</a></span></span><span class='period'>.</span><span class='id identifier rubyid_override'>override</span><span class='lparen'>(</span><span class='label'>stubbing_method_on_nil:</span> <span class='symbol'>:allow</span><span class='rparen'>)</span> <span class='kw'>do</span>
570
+ <span class='kw'>nil</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:foo</span><span class='rparen'>)</span>
571
+ <span class='kw'>end</span></code></pre>
572
+
573
+ </div>
574
+ <p class="tag_title">Parameters:</p>
575
+ <ul class="param">
576
+
577
+ <li>
578
+
579
+ <span class='name'>temporary_options</span>
580
+
581
+
582
+ <span class='type'>(<tt>Hash</tt>)</span>
583
+
584
+
585
+
586
+ &mdash;
587
+ <div class='inline'>
588
+ <p>the configuration options to apply for the duration of the block.</p>
589
+ </div>
590
+
591
+ </li>
592
+
593
+ </ul>
594
+
595
+ <p class="tag_title">Yields:</p>
596
+ <ul class="yield">
597
+
598
+ <li>
599
+
600
+
601
+ <span class='type'></span>
602
+
603
+
604
+
605
+
606
+ <div class='inline'>
607
+ <p>block during which the configuration change will be in force.</p>
608
+ </div>
609
+
610
+ </li>
611
+
612
+ </ul>
613
+
614
+ </div><table class="source_code">
615
+ <tr>
616
+ <td>
617
+ <pre class="lines">
618
+
619
+
620
+ 340
621
+ 341
622
+ 342
623
+ 343
624
+ 344
625
+ 345
626
+ 346</pre>
627
+ </td>
628
+ <td>
629
+ <pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 340</span>
630
+
631
+ <span class='kw'>def</span> <span class='id identifier rubyid_override'>override</span><span class='lparen'>(</span><span class='id identifier rubyid_temporary_options'>temporary_options</span><span class='rparen'>)</span>
632
+ <span class='id identifier rubyid_original_configuration'>original_configuration</span> <span class='op'>=</span> <span class='id identifier rubyid_configuration'>configuration</span>
633
+ <span class='ivar'>@configuration</span> <span class='op'>=</span> <span class='id identifier rubyid_configuration'>configuration</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_temporary_options'>temporary_options</span><span class='rparen'>)</span><span class='rparen'>)</span>
634
+ <span class='kw'>yield</span>
635
+ <span class='kw'>ensure</span>
636
+ <span class='ivar'>@configuration</span> <span class='op'>=</span> <span class='id identifier rubyid_original_configuration'>original_configuration</span>
637
+ <span class='kw'>end</span></pre>
638
+ </td>
639
+ </tr>
640
+ </table>
641
+ </div>
642
+
643
+ <div class="method_details ">
644
+ <h3 class="signature " id="prevent-class_method">
645
+
646
+ .<strong>prevent</strong>(action) { ... } &#x21d2; <tt><span class='object_link'>Object</span></tt>
647
+
648
+
649
+
650
+
651
+
652
+ </h3><div class="docstring">
653
+ <div class="discussion">
654
+ <div class="note deprecated"><strong>Deprecated.</strong> <div class='inline'>
655
+ <p>If a block is supplied, call <span class='object_link'><a href="#override-class_method" title="Mocha::Configuration.override (method)">override</a></span> with a <code>Hash</code> containing an entry with the <code>action</code> as the key and <code>:prevent</code> as the value. If no block is supplied, call the appropriate <code>action</code> writer method with <code>value</code> set to <code>:prevent</code> via <span class='object_link'><a href="../Mocha.html#configure-class_method" title="Mocha.configure (method)">Mocha.configure</a></span>. The writer method will be the one of the following corresponding to the <code>action</code>:</p>
656
+ <ul><li>
657
+ <p><span class='object_link'><a href="#stubbing_method_unnecessarily=-instance_method" title="Mocha::Configuration#stubbing_method_unnecessarily= (method)">#stubbing_method_unnecessarily=</a></span></p>
658
+ </li><li>
659
+ <p><span class='object_link'><a href="#stubbing_method_on_non_mock_object=-instance_method" title="Mocha::Configuration#stubbing_method_on_non_mock_object= (method)">#stubbing_method_on_non_mock_object=</a></span></p>
660
+ </li><li>
661
+ <p><span class='object_link'><a href="#stubbing_non_existent_method=-instance_method" title="Mocha::Configuration#stubbing_non_existent_method= (method)">#stubbing_non_existent_method=</a></span></p>
662
+ </li><li>
663
+ <p><span class='object_link'><a href="#stubbing_non_public_method=-instance_method" title="Mocha::Configuration#stubbing_non_public_method= (method)">#stubbing_non_public_method=</a></span></p>
664
+ </li><li>
665
+ <p><span class='object_link'><a href="#stubbing_method_on_nil=-instance_method" title="Mocha::Configuration#stubbing_method_on_nil= (method)">#stubbing_method_on_nil=</a></span></p>
666
+ </li></ul>
667
+ </div></div>
668
+
669
+ <p>Raise a <span class='object_link'><a href="StubbingError.html" title="Mocha::StubbingError (class)">StubbingError</a></span> if the specified <code>action</code> is attempted.</p>
670
+
671
+
672
+ </div>
673
+ </div>
674
+ <div class="tags">
675
+ <p class="tag_title">Parameters:</p>
676
+ <ul class="param">
677
+
678
+ <li>
679
+
680
+ <span class='name'>action</span>
681
+
682
+
683
+ <span class='type'>(<tt>Symbol</tt>)</span>
684
+
685
+
686
+
687
+ &mdash;
688
+ <div class='inline'>
689
+ <p>one of <code>:stubbing_method_unnecessarily</code>, <code>:stubbing_method_on_non_mock_object</code>, <code>:stubbing_non_existent_method</code>, <code>:stubbing_non_public_method</code>, <code>:stubbing_method_on_nil</code>.</p>
690
+ </div>
691
+
692
+ </li>
693
+
694
+ </ul>
695
+
696
+ <p class="tag_title">Yields:</p>
697
+ <ul class="yield">
698
+
699
+ <li>
700
+
701
+
702
+ <span class='type'></span>
703
+
704
+
705
+
706
+
707
+ <div class='inline'>
708
+ <p>optional block during which the configuration change will be changed before being returned to its original value at the end of the block.</p>
709
+ </div>
710
+
711
+ </li>
712
+
713
+ </ul>
714
+
715
+ </div><table class="source_code">
716
+ <tr>
717
+ <td>
718
+ <pre class="lines">
719
+
720
+
721
+ 309
722
+ 310
723
+ 311
724
+ 312
725
+ 313
726
+ 314
727
+ 315
728
+ 316</pre>
729
+ </td>
730
+ <td>
731
+ <pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 309</span>
732
+
733
+ <span class='kw'>def</span> <span class='id identifier rubyid_prevent'>prevent</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
734
+ <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
735
+ <span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Use Mocha::Configuration.override(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_action'>action</span><span class='embexpr_end'>}</span><span class='tstring_content'>: :prevent) with the same block</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
736
+ <span class='kw'>else</span>
737
+ <span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Use Mocha.configure { |c| c.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_action'>action</span><span class='embexpr_end'>}</span><span class='tstring_content'> = :prevent }</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
738
+ <span class='kw'>end</span>
739
+ <span class='id identifier rubyid_change_config'>change_config</span> <span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='symbol'>:prevent</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span>
740
+ <span class='kw'>end</span></pre>
741
+ </td>
742
+ </tr>
743
+ </table>
744
+ </div>
745
+
746
+ <div class="method_details ">
747
+ <h3 class="signature " id="warn_when-class_method">
748
+
749
+ .<strong>warn_when</strong>(action) { ... } &#x21d2; <tt><span class='object_link'>Object</span></tt>
750
+
751
+
752
+
753
+
754
+
755
+ </h3><div class="docstring">
756
+ <div class="discussion">
757
+ <div class="note deprecated"><strong>Deprecated.</strong> <div class='inline'>
758
+ <p>If a block is supplied, call <span class='object_link'><a href="#override-class_method" title="Mocha::Configuration.override (method)">override</a></span> with a <code>Hash</code> containing an entry with the <code>action</code> as the key and <code>:warn</code> as the value. If no block is supplied, call the appropriate <code>action</code> writer method with <code>value</code> set to <code>:warn</code> via <span class='object_link'><a href="../Mocha.html#configure-class_method" title="Mocha.configure (method)">Mocha.configure</a></span>. The writer method will be the one of the following corresponding to the <code>action</code>:</p>
759
+ <ul><li>
760
+ <p><span class='object_link'><a href="#stubbing_method_unnecessarily=-instance_method" title="Mocha::Configuration#stubbing_method_unnecessarily= (method)">#stubbing_method_unnecessarily=</a></span></p>
761
+ </li><li>
762
+ <p><span class='object_link'><a href="#stubbing_method_on_non_mock_object=-instance_method" title="Mocha::Configuration#stubbing_method_on_non_mock_object= (method)">#stubbing_method_on_non_mock_object=</a></span></p>
763
+ </li><li>
764
+ <p><span class='object_link'><a href="#stubbing_non_existent_method=-instance_method" title="Mocha::Configuration#stubbing_non_existent_method= (method)">#stubbing_non_existent_method=</a></span></p>
765
+ </li><li>
766
+ <p><span class='object_link'><a href="#stubbing_non_public_method=-instance_method" title="Mocha::Configuration#stubbing_non_public_method= (method)">#stubbing_non_public_method=</a></span></p>
767
+ </li><li>
768
+ <p><span class='object_link'><a href="#stubbing_method_on_nil=-instance_method" title="Mocha::Configuration#stubbing_method_on_nil= (method)">#stubbing_method_on_nil=</a></span></p>
769
+ </li></ul>
770
+ </div></div>
771
+
772
+ <p>Warn if the specified <code>action</code> is attempted.</p>
773
+
774
+
775
+ </div>
776
+ </div>
777
+ <div class="tags">
778
+ <p class="tag_title">Parameters:</p>
779
+ <ul class="param">
780
+
781
+ <li>
782
+
783
+ <span class='name'>action</span>
784
+
785
+
786
+ <span class='type'>(<tt>Symbol</tt>)</span>
787
+
788
+
789
+
790
+ &mdash;
791
+ <div class='inline'>
792
+ <p>one of <code>:stubbing_method_unnecessarily</code>, <code>:stubbing_method_on_non_mock_object</code>, <code>:stubbing_non_existent_method</code>, <code>:stubbing_non_public_method</code>, <code>:stubbing_method_on_nil</code>.</p>
793
+ </div>
794
+
795
+ </li>
796
+
797
+ </ul>
798
+
799
+ <p class="tag_title">Yields:</p>
800
+ <ul class="yield">
801
+
802
+ <li>
803
+
804
+
805
+ <span class='type'></span>
806
+
807
+
808
+
809
+
810
+ <div class='inline'>
811
+ <p>optional block during which the configuration change will be changed before being returned to its original value at the end of the block.</p>
812
+ </div>
813
+
814
+ </li>
815
+
816
+ </ul>
817
+
818
+ </div><table class="source_code">
819
+ <tr>
820
+ <td>
821
+ <pre class="lines">
822
+
823
+
824
+ 285
825
+ 286
826
+ 287
827
+ 288
828
+ 289
829
+ 290
830
+ 291
831
+ 292</pre>
832
+ </td>
833
+ <td>
834
+ <pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 285</span>
835
+
836
+ <span class='kw'>def</span> <span class='id identifier rubyid_warn_when'>warn_when</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
837
+ <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
838
+ <span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Use Mocha::Configuration.override(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_action'>action</span><span class='embexpr_end'>}</span><span class='tstring_content'>: :warn) with the same block</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
839
+ <span class='kw'>else</span>
840
+ <span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Use Mocha.configure { |c| c.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_action'>action</span><span class='embexpr_end'>}</span><span class='tstring_content'> = :warn }</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
841
+ <span class='kw'>end</span>
842
+ <span class='id identifier rubyid_change_config'>change_config</span> <span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='symbol'>:warn</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span>
843
+ <span class='kw'>end</span></pre>
844
+ </td>
845
+ </tr>
846
+ </table>
847
+ </div>
848
+
849
+ </div>
850
+
851
+ <div id="instance_method_details" class="method_details_list">
852
+ <h2>Instance Method Details</h2>
853
+
854
+
855
+ <div class="method_details first">
856
+ <h3 class="signature first" id="display_matching_invocations_on_failure=-instance_method">
857
+
858
+ #<strong>display_matching_invocations_on_failure=</strong>(value) &#x21d2; <tt><span class='object_link'>Object</span></tt>
859
+
860
+
861
+
862
+
863
+
864
+ </h3><div class="docstring">
865
+ <div class="discussion">
866
+
867
+ <p>Display matching invocations alongside expectations on Mocha-related test failure.</p>
868
+
869
+
870
+ </div>
871
+ </div>
872
+ <div class="tags">
873
+
874
+ <div class="examples">
875
+ <p class="tag_title">Examples:</p>
876
+
877
+
878
+ <p class="example_title"><div class='inline'>
879
+ <p>Enable display of matching invocations</p>
880
+ </div></p>
881
+
882
+ <pre class="example code"><code>Mocha.configure do |c|
883
+ c.display_matching_invocations_on_failure = true
884
+ end
885
+
886
+ foo = mock(&#39;foo&#39;)
887
+ foo.expects(:bar)
888
+ foo.stubs(:baz).returns(&#39;baz&#39;).raises(RuntimeError).throws(:tag, &#39;value&#39;)
889
+
890
+ foo.baz(1, 2)
891
+ assert_raises(RuntimeError) { foo.baz(3, 4) }
892
+ assert_throws(:tag) { foo.baz(5, 6) }
893
+
894
+ not all expectations were satisfied
895
+ unsatisfied expectations:
896
+ - expected exactly once, invoked never: #&lt;Mock:foo&gt;.bar
897
+ satisfied expectations:
898
+ - allowed any number of times, invoked 3 times: #&lt;Mock:foo&gt;.baz(any_parameters)
899
+ - #&lt;Mock:foo&gt;.baz(1, 2) # =&gt; &quot;baz&quot;
900
+ - #&lt;Mock:foo&gt;.baz(3, 4) # =&gt; raised RuntimeError
901
+ - #&lt;Mock:foo&gt;.baz(5, 6) # =&gt; threw (:tag, &quot;value&quot;)</code></pre>
902
+
903
+ </div>
904
+ <p class="tag_title">Parameters:</p>
905
+ <ul class="param">
906
+
907
+ <li>
908
+
909
+ <span class='name'>value</span>
910
+
911
+
912
+ <span class='type'>(<tt>Boolean</tt>)</span>
913
+
914
+
915
+
916
+ &mdash;
917
+ <div class='inline'>
918
+ <p><code>true</code> to enable display of matching invocations; disabled by default.</p>
919
+ </div>
920
+
921
+ </li>
922
+
923
+ </ul>
924
+
925
+
926
+ </div><table class="source_code">
927
+ <tr>
928
+ <td>
929
+ <pre class="lines">
930
+
931
+
932
+ 241
933
+ 242
934
+ 243</pre>
935
+ </td>
936
+ <td>
937
+ <pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 241</span>
938
+
939
+ <span class='kw'>def</span> <span class='id identifier rubyid_display_matching_invocations_on_failure='>display_matching_invocations_on_failure=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
940
+ <span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:display_matching_invocations_on_failure</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
941
+ <span class='kw'>end</span></pre>
942
+ </td>
943
+ </tr>
944
+ </table>
945
+ </div>
946
+
947
+ <div class="method_details ">
948
+ <h3 class="signature " id="stubbing_method_on_nil=-instance_method">
949
+
950
+ #<strong>stubbing_method_on_nil=</strong>(value) &#x21d2; <tt><span class='object_link'>Object</span></tt>
951
+
952
+
953
+
954
+
955
+
956
+ </h3><div class="docstring">
957
+ <div class="discussion">
958
+
959
+ <p>Configure whether stubbing methods on the <code>nil</code> object is allowed.</p>
960
+
961
+ <p>This is usually done accidentally, but there might be rare cases where it is intended.</p>
962
+
963
+ <p>This option only works for Ruby &lt; v2.2.0. In later versions of Ruby <code>nil</code> is frozen and so a <span class='object_link'><a href="StubbingError.html" title="Mocha::StubbingError (class)">StubbingError</a></span> will be raised if you attempt to stub a method on <code>nil</code>.</p>
964
+
965
+ <p>When <code>value</code> is <code>:allow</code>, do nothing. When <code>value</code> is <code>:warn</code>, display a warning. When <code>value</code> is <code>:prevent</code>, raise a <span class='object_link'><a href="StubbingError.html" title="Mocha::StubbingError (class)">StubbingError</a></span>. This is the default.</p>
966
+
967
+
968
+ </div>
969
+ </div>
970
+ <div class="tags">
971
+ <p class="tag_title">Parameters:</p>
972
+ <ul class="param">
973
+
974
+ <li>
975
+
976
+ <span class='name'>value</span>
977
+
978
+
979
+ <span class='type'>(<tt>Symbol</tt>)</span>
980
+
981
+
982
+
983
+ &mdash;
984
+ <div class='inline'>
985
+ <p>one of <code>:allow</code>, <code>:warn</code>, <code>:prevent</code>.</p>
986
+ </div>
987
+
988
+ </li>
989
+
990
+ </ul>
991
+
992
+
993
+ </div><table class="source_code">
994
+ <tr>
995
+ <td>
996
+ <pre class="lines">
997
+
998
+
999
+ 207
1000
+ 208
1001
+ 209</pre>
1002
+ </td>
1003
+ <td>
1004
+ <pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 207</span>
1005
+
1006
+ <span class='kw'>def</span> <span class='id identifier rubyid_stubbing_method_on_nil='>stubbing_method_on_nil=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1007
+ <span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:stubbing_method_on_nil</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
1008
+ <span class='kw'>end</span></pre>
1009
+ </td>
1010
+ </tr>
1011
+ </table>
1012
+ </div>
1013
+
1014
+ <div class="method_details ">
1015
+ <h3 class="signature " id="stubbing_method_on_non_mock_object=-instance_method">
1016
+
1017
+ #<strong>stubbing_method_on_non_mock_object=</strong>(value) &#x21d2; <tt><span class='object_link'>Object</span></tt>
1018
+
1019
+
1020
+
1021
+
1022
+
1023
+ </h3><div class="docstring">
1024
+ <div class="discussion">
1025
+
1026
+ <p>Configure whether stubbing methods on non-mock objects is allowed.</p>
1027
+
1028
+ <p>If you like the idea of <a href="http://www.jmock.org/oopsla2004.pdf" target="_parent" title="mocking roles not objects">mocking roles not objects</a> and <a href="http://www.mockobjects.com/2007/04/test-smell-mocking-concrete-classes.html" target="_parent" title="you don&amp;#39;t like stubbing concrete classes">you don&#39;t like stubbing concrete classes</a>, this is the setting for you. However, while this restriction makes a lot of sense in Java with its <a href="http://java.sun.com/docs/books/tutorial/java/concepts/interface.html" target="_parent" title="explicit interfaces">explicit interfaces</a>, it may be moot in Ruby where roles are probably best represented as Modules.</p>
1029
+
1030
+ <p>When <code>value</code> is <code>:allow</code>, do nothing. This is the default. When <code>value</code> is <code>:warn</code>, display a warning. When <code>value</code> is <code>:prevent</code>, raise a <span class='object_link'><a href="StubbingError.html" title="Mocha::StubbingError (class)">StubbingError</a></span>.</p>
1031
+
1032
+
1033
+ </div>
1034
+ </div>
1035
+ <div class="tags">
1036
+
1037
+ <div class="examples">
1038
+ <p class="tag_title">Examples:</p>
1039
+
1040
+
1041
+ <p class="example_title"><div class='inline'>
1042
+ <p>Preventing stubbing of a method on a non-mock object</p>
1043
+ </div></p>
1044
+
1045
+ <pre class="example code"><code><span class='const'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span><span class='period'>.</span><span class='id identifier rubyid_configure'><span class='object_link'><a href="../Mocha.html#configure-class_method" title="Mocha.configure (method)">configure</a></span></span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span>
1046
+ <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'>:prevent</span>
1047
+ <span class='kw'>end</span>
1048
+
1049
+ <span class='kw'>class</span> <span class='const'>Example</span>
1050
+ <span class='kw'>def</span> <span class='id identifier rubyid_example_method'>example_method</span><span class='semicolon'>;</span> <span class='kw'>end</span>
1051
+ <span class='kw'>end</span>
1052
+
1053
+ <span class='id identifier rubyid_example'>example</span> <span class='op'>=</span> <span class='const'>Example</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
1054
+ <span class='id identifier rubyid_example'>example</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:example_method</span><span class='rparen'>)</span>
1055
+ <span class='comment'># =&gt; Mocha::StubbingError: stubbing method on non-mock object:
1056
+ </span><span class='comment'># =&gt; #&lt;Example:0x593620&gt;.example_method</span></code></pre>
1057
+
1058
+ </div>
1059
+ <p class="tag_title">Parameters:</p>
1060
+ <ul class="param">
1061
+
1062
+ <li>
1063
+
1064
+ <span class='name'>value</span>
1065
+
1066
+
1067
+ <span class='type'>(<tt>Symbol</tt>)</span>
1068
+
1069
+
1070
+
1071
+ &mdash;
1072
+ <div class='inline'>
1073
+ <p>one of <code>:allow</code>, <code>:warn</code>, <code>:prevent</code>.</p>
1074
+ </div>
1075
+
1076
+ </li>
1077
+
1078
+ </ul>
1079
+
1080
+
1081
+ </div><table class="source_code">
1082
+ <tr>
1083
+ <td>
1084
+ <pre class="lines">
1085
+
1086
+
1087
+ 119
1088
+ 120
1089
+ 121</pre>
1090
+ </td>
1091
+ <td>
1092
+ <pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 119</span>
1093
+
1094
+ <span class='kw'>def</span> <span class='id identifier rubyid_stubbing_method_on_non_mock_object='>stubbing_method_on_non_mock_object=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1095
+ <span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:stubbing_method_on_non_mock_object</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
1096
+ <span class='kw'>end</span></pre>
1097
+ </td>
1098
+ </tr>
1099
+ </table>
1100
+ </div>
1101
+
1102
+ <div class="method_details ">
1103
+ <h3 class="signature " id="stubbing_method_unnecessarily=-instance_method">
1104
+
1105
+ #<strong>stubbing_method_unnecessarily=</strong>(value) &#x21d2; <tt><span class='object_link'>Object</span></tt>
1106
+
1107
+
1108
+
1109
+
1110
+
1111
+ </h3><div class="docstring">
1112
+ <div class="discussion">
1113
+
1114
+ <p>Configure whether stubbing methods unnecessarily is allowed.</p>
1115
+
1116
+ <p>This is useful for identifying unused stubs. Unused stubs are often accidentally introduced when code is <a href="http://martinfowler.com/bliki/DefinitionOfRefactoring.html" target="_parent" title="refactored">refactored</a>.</p>
1117
+
1118
+ <p>When <code>value</code> is <code>:allow</code>, do nothing. This is the default. When <code>value</code> is <code>:warn</code>, display a warning. When <code>value</code> is <code>:prevent</code>, raise a <span class='object_link'><a href="StubbingError.html" title="Mocha::StubbingError (class)">StubbingError</a></span>.</p>
1119
+
1120
+
1121
+ </div>
1122
+ </div>
1123
+ <div class="tags">
1124
+
1125
+ <div class="examples">
1126
+ <p class="tag_title">Examples:</p>
1127
+
1128
+
1129
+ <p class="example_title"><div class='inline'>
1130
+ <p>Preventing unnecessary stubbing of a method</p>
1131
+ </div></p>
1132
+
1133
+ <pre class="example code"><code><span class='const'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span><span class='period'>.</span><span class='id identifier rubyid_configure'><span class='object_link'><a href="../Mocha.html#configure-class_method" title="Mocha.configure (method)">configure</a></span></span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span>
1134
+ <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>
1135
+ <span class='kw'>end</span>
1136
+
1137
+ <span class='id identifier rubyid_example'>example</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>example</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
1138
+ <span class='id identifier rubyid_example'>example</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:unused_stub</span><span class='rparen'>)</span>
1139
+ <span class='comment'># =&gt; Mocha::StubbingError: stubbing method unnecessarily:
1140
+ </span><span class='comment'># =&gt; #&lt;Mock:example&gt;.unused_stub(any_parameters)</span></code></pre>
1141
+
1142
+ </div>
1143
+ <p class="tag_title">Parameters:</p>
1144
+ <ul class="param">
1145
+
1146
+ <li>
1147
+
1148
+ <span class='name'>value</span>
1149
+
1150
+
1151
+ <span class='type'>(<tt>Symbol</tt>)</span>
1152
+
1153
+
1154
+
1155
+ &mdash;
1156
+ <div class='inline'>
1157
+ <p>one of <code>:allow</code>, <code>:warn</code>, <code>:prevent</code>.</p>
1158
+ </div>
1159
+
1160
+ </li>
1161
+
1162
+ </ul>
1163
+
1164
+
1165
+ </div><table class="source_code">
1166
+ <tr>
1167
+ <td>
1168
+ <pre class="lines">
1169
+
1170
+
1171
+ 86
1172
+ 87
1173
+ 88</pre>
1174
+ </td>
1175
+ <td>
1176
+ <pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 86</span>
1177
+
1178
+ <span class='kw'>def</span> <span class='id identifier rubyid_stubbing_method_unnecessarily='>stubbing_method_unnecessarily=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1179
+ <span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:stubbing_method_unnecessarily</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
1180
+ <span class='kw'>end</span></pre>
1181
+ </td>
1182
+ </tr>
1183
+ </table>
1184
+ </div>
1185
+
1186
+ <div class="method_details ">
1187
+ <h3 class="signature " id="stubbing_non_existent_method=-instance_method">
1188
+
1189
+ #<strong>stubbing_non_existent_method=</strong>(value) &#x21d2; <tt><span class='object_link'>Object</span></tt>
1190
+
1191
+
1192
+
1193
+
1194
+
1195
+ </h3><div class="docstring">
1196
+ <div class="discussion">
1197
+
1198
+ <p>Configure whether stubbing of non-existent methods is allowed.</p>
1199
+
1200
+ <p>This is useful if you want to ensure that methods you&#39;re mocking really exist. A common criticism of unit tests with mock objects is that such a test may (incorrectly) pass when an equivalent non-mocking test would (correctly) fail. While you should always have some integration tests, particularly for critical business functionality, this Mocha configuration setting should catch scenarios when mocked methods and real methods have become misaligned.</p>
1201
+
1202
+ <p>When <code>value</code> is <code>:allow</code>, do nothing. This is the default. When <code>value</code> is <code>:warn</code>, display a warning. When <code>value</code> is <code>:prevent</code>, raise a <span class='object_link'><a href="StubbingError.html" title="Mocha::StubbingError (class)">StubbingError</a></span>.</p>
1203
+
1204
+
1205
+ </div>
1206
+ </div>
1207
+ <div class="tags">
1208
+
1209
+ <div class="examples">
1210
+ <p class="tag_title">Examples:</p>
1211
+
1212
+
1213
+ <p class="example_title"><div class='inline'>
1214
+ <p>Preventing stubbing of a non-existent method</p>
1215
+ </div></p>
1216
+
1217
+ <pre class="example code"><code>
1218
+ <span class='const'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span><span class='period'>.</span><span class='id identifier rubyid_configure'><span class='object_link'><a href="../Mocha.html#configure-class_method" title="Mocha.configure (method)">configure</a></span></span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span>
1219
+ <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_stubbing_non_existent_method'>stubbing_non_existent_method</span> <span class='op'>=</span> <span class='symbol'>:prevent</span>
1220
+ <span class='kw'>end</span>
1221
+
1222
+ <span class='kw'>class</span> <span class='const'>Example</span>
1223
+ <span class='kw'>end</span>
1224
+
1225
+ <span class='id identifier rubyid_example'>example</span> <span class='op'>=</span> <span class='const'>Example</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
1226
+ <span class='id identifier rubyid_example'>example</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:method_that_doesnt_exist</span><span class='rparen'>)</span>
1227
+ <span class='comment'># =&gt; Mocha::StubbingError: stubbing non-existent method:
1228
+ </span><span class='comment'># =&gt; #&lt;Example:0x593760&gt;.method_that_doesnt_exist</span></code></pre>
1229
+
1230
+ </div>
1231
+ <p class="tag_title">Parameters:</p>
1232
+ <ul class="param">
1233
+
1234
+ <li>
1235
+
1236
+ <span class='name'>value</span>
1237
+
1238
+
1239
+ <span class='type'>(<tt>Symbol</tt>)</span>
1240
+
1241
+
1242
+
1243
+ &mdash;
1244
+ <div class='inline'>
1245
+ <p>one of <code>:allow</code>, <code>:warn</code>, <code>:prevent</code>.</p>
1246
+ </div>
1247
+
1248
+ </li>
1249
+
1250
+ </ul>
1251
+
1252
+
1253
+ </div><table class="source_code">
1254
+ <tr>
1255
+ <td>
1256
+ <pre class="lines">
1257
+
1258
+
1259
+ 152
1260
+ 153
1261
+ 154</pre>
1262
+ </td>
1263
+ <td>
1264
+ <pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 152</span>
1265
+
1266
+ <span class='kw'>def</span> <span class='id identifier rubyid_stubbing_non_existent_method='>stubbing_non_existent_method=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1267
+ <span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:stubbing_non_existent_method</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
1268
+ <span class='kw'>end</span></pre>
1269
+ </td>
1270
+ </tr>
1271
+ </table>
1272
+ </div>
1273
+
1274
+ <div class="method_details ">
1275
+ <h3 class="signature " id="stubbing_non_public_method=-instance_method">
1276
+
1277
+ #<strong>stubbing_non_public_method=</strong>(value) &#x21d2; <tt><span class='object_link'>Object</span></tt>
1278
+
1279
+
1280
+
1281
+
1282
+
1283
+ </h3><div class="docstring">
1284
+ <div class="discussion">
1285
+
1286
+ <p>Configure whether stubbing of non-public methods is allowed.</p>
1287
+
1288
+ <p>Many people think that it&#39;s good practice only to mock public methods. This is one way to prevent your tests being too tightly coupled to the internal implementation of a class. Such tests tend to be very brittle and not much use when refactoring.</p>
1289
+
1290
+ <p>When <code>value</code> is <code>:allow</code>, do nothing. This is the default. When <code>value</code> is <code>:warn</code>, display a warning. When <code>value</code> is <code>:prevent</code>, raise a <span class='object_link'><a href="StubbingError.html" title="Mocha::StubbingError (class)">StubbingError</a></span>.</p>
1291
+
1292
+
1293
+ </div>
1294
+ </div>
1295
+ <div class="tags">
1296
+
1297
+ <div class="examples">
1298
+ <p class="tag_title">Examples:</p>
1299
+
1300
+
1301
+ <p class="example_title"><div class='inline'>
1302
+ <p>Preventing stubbing of a non-public method</p>
1303
+ </div></p>
1304
+
1305
+ <pre class="example code"><code><span class='const'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span><span class='period'>.</span><span class='id identifier rubyid_configure'><span class='object_link'><a href="../Mocha.html#configure-class_method" title="Mocha.configure (method)">configure</a></span></span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span>
1306
+ <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_stubbing_non_public_method'>stubbing_non_public_method</span> <span class='op'>=</span> <span class='symbol'>:prevent</span>
1307
+ <span class='kw'>end</span>
1308
+
1309
+ <span class='kw'>class</span> <span class='const'>Example</span>
1310
+ <span class='kw'>def</span> <span class='id identifier rubyid_internal_method'>internal_method</span><span class='semicolon'>;</span> <span class='kw'>end</span>
1311
+ <span class='id identifier rubyid_private'>private</span> <span class='symbol'>:internal_method</span>
1312
+ <span class='kw'>end</span>
1313
+
1314
+ <span class='id identifier rubyid_example'>example</span> <span class='op'>=</span> <span class='const'>Example</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
1315
+ <span class='id identifier rubyid_example'>example</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:internal_method</span><span class='rparen'>)</span>
1316
+ <span class='comment'># =&gt; Mocha::StubbingError: stubbing non-public method:
1317
+ </span><span class='comment'># =&gt; #&lt;Example:0x593530&gt;.internal_method</span></code></pre>
1318
+
1319
+ </div>
1320
+ <p class="tag_title">Parameters:</p>
1321
+ <ul class="param">
1322
+
1323
+ <li>
1324
+
1325
+ <span class='name'>value</span>
1326
+
1327
+
1328
+ <span class='type'>(<tt>Symbol</tt>)</span>
1329
+
1330
+
1331
+
1332
+ &mdash;
1333
+ <div class='inline'>
1334
+ <p>one of <code>:allow</code>, <code>:warn</code>, <code>:prevent</code>.</p>
1335
+ </div>
1336
+
1337
+ </li>
1338
+
1339
+ </ul>
1340
+
1341
+
1342
+ </div><table class="source_code">
1343
+ <tr>
1344
+ <td>
1345
+ <pre class="lines">
1346
+
1347
+
1348
+ 186
1349
+ 187
1350
+ 188</pre>
1351
+ </td>
1352
+ <td>
1353
+ <pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 186</span>
1354
+
1355
+ <span class='kw'>def</span> <span class='id identifier rubyid_stubbing_non_public_method='>stubbing_non_public_method=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1356
+ <span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:stubbing_non_public_method</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
1357
+ <span class='kw'>end</span></pre>
1358
+ </td>
1359
+ </tr>
1360
+ </table>
1361
+ </div>
1362
+
1363
+ </div>
1364
+
1365
+ <script async src="https://www.googletagmanager.com/gtag/js?id=UA-625523-7"></script>
1366
+ <script>
1367
+ window.dataLayer = window.dataLayer || [];
1368
+ function gtag(){dataLayer.push(arguments);}
1369
+ gtag('js', new Date());
1370
+
1371
+ gtag('config', 'UA-625523-7');
1372
+ </script>
1373
+ </div>
1374
+
1375
+ <div id="footer">
1376
+ Generated on Sun Nov 24 15:26:50 2019 by
1377
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1378
+ 0.9.20 (ruby-2.6.5).
1379
+ </div>
1380
+
1381
+ </div>
1382
+ </body>
1383
+ </html>