mocha 1.4.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (269) hide show
  1. checksums.yaml +5 -5
  2. data/.github/FUNDING.yml +1 -0
  3. data/.rubocop.yml +53 -0
  4. data/.rubocop_todo.yml +27 -0
  5. data/.yardopts +1 -1
  6. data/CONTRIBUTING.md +4 -9
  7. data/COPYING.md +2 -2
  8. data/Gemfile +27 -0
  9. data/MIT-LICENSE.md +1 -1
  10. data/README.md +88 -117
  11. data/RELEASE.md +340 -0
  12. data/Rakefile +53 -52
  13. data/gemfiles/Gemfile.minitest.latest +1 -0
  14. data/gemfiles/Gemfile.test-unit.latest +2 -5
  15. data/lib/mocha/any_instance_method.rb +9 -62
  16. data/lib/mocha/api.rb +84 -74
  17. data/lib/mocha/argument_iterator.rb +4 -8
  18. data/lib/mocha/backtrace_filter.rb +3 -7
  19. data/lib/mocha/block_matcher.rb +31 -0
  20. data/lib/mocha/cardinality.rb +60 -49
  21. data/lib/mocha/central.rb +21 -12
  22. data/lib/mocha/change_state_side_effect.rb +0 -4
  23. data/lib/mocha/class_methods.rb +19 -21
  24. data/lib/mocha/configuration.rb +317 -52
  25. data/lib/mocha/debug.rb +2 -4
  26. data/lib/mocha/deprecation.rb +6 -12
  27. data/lib/mocha/detection/mini_test.rb +0 -2
  28. data/lib/mocha/detection/test_unit.rb +3 -5
  29. data/lib/mocha/error_with_filtered_backtrace.rb +13 -0
  30. data/lib/mocha/exception_raiser.rb +4 -6
  31. data/lib/mocha/expectation.rb +186 -95
  32. data/lib/mocha/expectation_error.rb +1 -1
  33. data/lib/mocha/expectation_error_factory.rb +0 -1
  34. data/lib/mocha/expectation_list.rb +7 -11
  35. data/lib/mocha/hooks.rb +1 -3
  36. data/lib/mocha/in_state_ordering_constraint.rb +0 -4
  37. data/lib/mocha/inspect.rb +30 -28
  38. data/lib/mocha/instance_method.rb +14 -3
  39. data/lib/mocha/integration/mini_test/adapter.rb +3 -5
  40. data/lib/mocha/integration/mini_test/exception_translation.rb +1 -1
  41. data/lib/mocha/integration/mini_test.rb +10 -31
  42. data/lib/mocha/integration/monkey_patcher.rb +5 -7
  43. data/lib/mocha/integration/test_unit/adapter.rb +8 -9
  44. data/lib/mocha/integration/test_unit.rb +10 -26
  45. data/lib/mocha/invocation.rb +73 -0
  46. data/lib/mocha/is_a.rb +0 -2
  47. data/lib/mocha/logger.rb +0 -4
  48. data/lib/mocha/macos_version.rb +5 -0
  49. data/lib/mocha/method_matcher.rb +1 -5
  50. data/lib/mocha/minitest.rb +5 -2
  51. data/lib/mocha/mock.rb +104 -68
  52. data/lib/mocha/mockery.rb +70 -99
  53. data/lib/mocha/names.rb +2 -12
  54. data/lib/mocha/not_initialized_error.rb +7 -0
  55. data/lib/mocha/object_methods.rb +25 -31
  56. data/lib/mocha/parameter_matchers/all_of.rb +2 -8
  57. data/lib/mocha/parameter_matchers/any_of.rb +2 -8
  58. data/lib/mocha/parameter_matchers/any_parameters.rb +3 -9
  59. data/lib/mocha/parameter_matchers/anything.rb +2 -8
  60. data/lib/mocha/parameter_matchers/base.rb +7 -13
  61. data/lib/mocha/parameter_matchers/equals.rb +0 -6
  62. data/lib/mocha/parameter_matchers/equivalent_uri.rb +3 -13
  63. data/lib/mocha/parameter_matchers/has_entries.rb +2 -7
  64. data/lib/mocha/parameter_matchers/has_entry.rb +26 -21
  65. data/lib/mocha/parameter_matchers/has_key.rb +2 -7
  66. data/lib/mocha/parameter_matchers/has_keys.rb +53 -0
  67. data/lib/mocha/parameter_matchers/has_value.rb +2 -7
  68. data/lib/mocha/parameter_matchers/includes.rb +4 -6
  69. data/lib/mocha/parameter_matchers/instance_methods.rb +27 -0
  70. data/lib/mocha/parameter_matchers/instance_of.rb +0 -6
  71. data/lib/mocha/parameter_matchers/is_a.rb +2 -7
  72. data/lib/mocha/parameter_matchers/kind_of.rb +2 -6
  73. data/lib/mocha/parameter_matchers/not.rb +2 -7
  74. data/lib/mocha/parameter_matchers/optionally.rb +4 -10
  75. data/lib/mocha/parameter_matchers/positional_or_keyword_hash.rb +64 -0
  76. data/lib/mocha/parameter_matchers/regexp_matches.rb +0 -6
  77. data/lib/mocha/parameter_matchers/responds_with.rb +3 -8
  78. data/lib/mocha/parameter_matchers/yaml_equivalent.rb +2 -6
  79. data/lib/mocha/parameter_matchers.rb +2 -3
  80. data/lib/mocha/parameters_matcher.rb +8 -11
  81. data/lib/mocha/raised_exception.rb +11 -0
  82. data/lib/mocha/receivers.rb +10 -14
  83. data/lib/mocha/return_values.rb +4 -8
  84. data/lib/mocha/ruby_version.rb +1 -2
  85. data/lib/mocha/sequence.rb +4 -9
  86. data/lib/mocha/single_return_value.rb +2 -5
  87. data/lib/mocha/state_machine.rb +33 -46
  88. data/lib/mocha/stubbed_method.rb +88 -0
  89. data/lib/mocha/stubbing_error.rb +2 -13
  90. data/lib/mocha/test_unit.rb +5 -2
  91. data/lib/mocha/thrower.rb +4 -6
  92. data/lib/mocha/thrown_object.rb +12 -0
  93. data/lib/mocha/version.rb +1 -1
  94. data/lib/mocha/yield_parameters.rb +7 -17
  95. data/mocha.gemspec +15 -65
  96. metadata +27 -257
  97. data/bin/build-matrix +0 -70
  98. data/gemfiles/Gemfile.minitest.1.3.0 +0 -7
  99. data/gemfiles/Gemfile.minitest.1.4.0 +0 -7
  100. data/gemfiles/Gemfile.minitest.1.4.1 +0 -7
  101. data/gemfiles/Gemfile.minitest.1.4.2 +0 -7
  102. data/gemfiles/Gemfile.minitest.2.0.0 +0 -7
  103. data/gemfiles/Gemfile.minitest.2.0.1 +0 -7
  104. data/gemfiles/Gemfile.minitest.2.11.0 +0 -7
  105. data/gemfiles/Gemfile.minitest.2.11.2 +0 -7
  106. data/gemfiles/Gemfile.minitest.2.3.0 +0 -7
  107. data/gemfiles/Gemfile.test-unit.2.0.0 +0 -7
  108. data/gemfiles/Gemfile.test-unit.2.0.1 +0 -7
  109. data/gemfiles/Gemfile.test-unit.2.0.3 +0 -7
  110. data/init.rb +0 -3
  111. data/lib/mocha/class_method.rb +0 -119
  112. data/lib/mocha/integration/mini_test/nothing.rb +0 -19
  113. data/lib/mocha/integration/mini_test/version_13.rb +0 -51
  114. data/lib/mocha/integration/mini_test/version_140.rb +0 -51
  115. data/lib/mocha/integration/mini_test/version_141.rb +0 -62
  116. data/lib/mocha/integration/mini_test/version_142_to_172.rb +0 -62
  117. data/lib/mocha/integration/mini_test/version_200.rb +0 -63
  118. data/lib/mocha/integration/mini_test/version_201_to_222.rb +0 -63
  119. data/lib/mocha/integration/mini_test/version_2110_to_2111.rb +0 -67
  120. data/lib/mocha/integration/mini_test/version_2112_to_320.rb +0 -70
  121. data/lib/mocha/integration/mini_test/version_230_to_2101.rb +0 -65
  122. data/lib/mocha/integration/test_unit/gem_version_200.rb +0 -59
  123. data/lib/mocha/integration/test_unit/gem_version_201_to_202.rb +0 -59
  124. data/lib/mocha/integration/test_unit/gem_version_203_to_220.rb +0 -59
  125. data/lib/mocha/integration/test_unit/gem_version_230_to_250.rb +0 -65
  126. data/lib/mocha/integration/test_unit/nothing.rb +0 -19
  127. data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +0 -58
  128. data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +0 -60
  129. data/lib/mocha/integration.rb +0 -14
  130. data/lib/mocha/mini_test.rb +0 -5
  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/setup.rb +0 -9
  138. data/lib/mocha/single_yield.rb +0 -18
  139. data/lib/mocha/standalone.rb +0 -4
  140. data/lib/mocha/unexpected_invocation.rb +0 -26
  141. data/lib/mocha_standalone.rb +0 -4
  142. data/test/acceptance/acceptance_test_helper.rb +0 -41
  143. data/test/acceptance/bug_18914_test.rb +0 -43
  144. data/test/acceptance/bug_21465_test.rb +0 -34
  145. data/test/acceptance/bug_21563_test.rb +0 -25
  146. data/test/acceptance/exception_rescue_test.rb +0 -55
  147. data/test/acceptance/expectations_on_multiple_methods_test.rb +0 -55
  148. data/test/acceptance/expected_invocation_count_test.rb +0 -232
  149. data/test/acceptance/failure_messages_test.rb +0 -64
  150. data/test/acceptance/issue_272_test.rb +0 -52
  151. data/test/acceptance/issue_65_test.rb +0 -63
  152. data/test/acceptance/issue_70_test.rb +0 -55
  153. data/test/acceptance/mocha_example_test.rb +0 -98
  154. data/test/acceptance/mocha_test_result_test.rb +0 -84
  155. data/test/acceptance/mock_test.rb +0 -100
  156. data/test/acceptance/mock_with_initializer_block_test.rb +0 -58
  157. data/test/acceptance/mocked_methods_dispatch_test.rb +0 -78
  158. data/test/acceptance/multiple_expectations_failure_message_test.rb +0 -68
  159. data/test/acceptance/optional_parameters_test.rb +0 -70
  160. data/test/acceptance/parameter_matcher_test.rb +0 -301
  161. data/test/acceptance/partial_mocks_test.rb +0 -47
  162. data/test/acceptance/prepend_test.rb +0 -89
  163. data/test/acceptance/raise_exception_test.rb +0 -39
  164. data/test/acceptance/return_value_test.rb +0 -52
  165. data/test/acceptance/sequence_test.rb +0 -192
  166. data/test/acceptance/states_test.rb +0 -70
  167. data/test/acceptance/stub_any_instance_method_defined_on_superclass_test.rb +0 -34
  168. data/test/acceptance/stub_any_instance_method_test.rb +0 -280
  169. data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +0 -106
  170. data/test/acceptance/stub_class_method_defined_on_class_test.rb +0 -78
  171. data/test/acceptance/stub_class_method_defined_on_module_test.rb +0 -75
  172. data/test/acceptance/stub_class_method_defined_on_superclass_test.rb +0 -112
  173. data/test/acceptance/stub_everything_test.rb +0 -56
  174. data/test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb +0 -93
  175. data/test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb +0 -69
  176. data/test/acceptance/stub_instance_method_defined_on_class_test.rb +0 -69
  177. data/test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb +0 -75
  178. data/test/acceptance/stub_instance_method_defined_on_module_test.rb +0 -78
  179. data/test/acceptance/stub_instance_method_defined_on_object_class_test.rb +0 -75
  180. data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +0 -70
  181. data/test/acceptance/stub_instance_method_defined_on_superclass_test.rb +0 -72
  182. data/test/acceptance/stub_method_defined_on_module_and_aliased_test.rb +0 -39
  183. data/test/acceptance/stub_module_method_test.rb +0 -201
  184. data/test/acceptance/stub_test.rb +0 -52
  185. data/test/acceptance/stubba_example_test.rb +0 -102
  186. data/test/acceptance/stubba_test_result_test.rb +0 -75
  187. data/test/acceptance/stubbing_error_backtrace_test.rb +0 -64
  188. data/test/acceptance/stubbing_frozen_object_test.rb +0 -88
  189. data/test/acceptance/stubbing_method_accepting_block_parameter_test.rb +0 -48
  190. data/test/acceptance/stubbing_method_unnecessarily_test.rb +0 -65
  191. data/test/acceptance/stubbing_nil_test.rb +0 -61
  192. data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +0 -143
  193. data/test/acceptance/stubbing_non_existent_class_method_test.rb +0 -157
  194. data/test/acceptance/stubbing_non_existent_instance_method_test.rb +0 -147
  195. data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +0 -130
  196. data/test/acceptance/stubbing_non_public_class_method_test.rb +0 -163
  197. data/test/acceptance/stubbing_non_public_instance_method_test.rb +0 -143
  198. data/test/acceptance/stubbing_on_non_mock_object_test.rb +0 -76
  199. data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +0 -35
  200. data/test/acceptance/throw_test.rb +0 -45
  201. data/test/acceptance/unexpected_invocation_test.rb +0 -25
  202. data/test/acceptance/unstubbing_test.rb +0 -168
  203. data/test/assertions.rb +0 -8
  204. data/test/deprecation_disabler.rb +0 -16
  205. data/test/execution_point.rb +0 -38
  206. data/test/integration/mini_test_test.rb +0 -8
  207. data/test/integration/shared_tests.rb +0 -174
  208. data/test/integration/test_unit_test.rb +0 -8
  209. data/test/method_definer.rb +0 -24
  210. data/test/mini_test_result.rb +0 -90
  211. data/test/minitest_result.rb +0 -49
  212. data/test/simple_counter.rb +0 -13
  213. data/test/test_helper.rb +0 -50
  214. data/test/test_runner.rb +0 -58
  215. data/test/test_unit_result.rb +0 -20
  216. data/test/unit/any_instance_method_test.rb +0 -136
  217. data/test/unit/array_inspect_test.rb +0 -16
  218. data/test/unit/backtrace_filter_test.rb +0 -19
  219. data/test/unit/cardinality_test.rb +0 -56
  220. data/test/unit/central_test.rb +0 -100
  221. data/test/unit/change_state_side_effect_test.rb +0 -41
  222. data/test/unit/class_method_test.rb +0 -229
  223. data/test/unit/class_methods_test.rb +0 -40
  224. data/test/unit/configuration_test.rb +0 -38
  225. data/test/unit/date_time_inspect_test.rb +0 -21
  226. data/test/unit/exception_raiser_test.rb +0 -42
  227. data/test/unit/expectation_list_test.rb +0 -82
  228. data/test/unit/expectation_test.rb +0 -497
  229. data/test/unit/hash_inspect_test.rb +0 -16
  230. data/test/unit/hooks_test.rb +0 -29
  231. data/test/unit/in_state_ordering_constraint_test.rb +0 -43
  232. data/test/unit/method_matcher_test.rb +0 -28
  233. data/test/unit/mock_test.rb +0 -350
  234. data/test/unit/mockery_test.rb +0 -157
  235. data/test/unit/module_methods_test.rb +0 -19
  236. data/test/unit/multiple_yields_test.rb +0 -18
  237. data/test/unit/no_yields_test.rb +0 -18
  238. data/test/unit/object_inspect_test.rb +0 -39
  239. data/test/unit/object_methods_test.rb +0 -46
  240. data/test/unit/parameter_matchers/all_of_test.rb +0 -26
  241. data/test/unit/parameter_matchers/any_of_test.rb +0 -26
  242. data/test/unit/parameter_matchers/anything_test.rb +0 -21
  243. data/test/unit/parameter_matchers/equals_test.rb +0 -25
  244. data/test/unit/parameter_matchers/equivalent_uri_test.rb +0 -51
  245. data/test/unit/parameter_matchers/has_entries_test.rb +0 -51
  246. data/test/unit/parameter_matchers/has_entry_test.rb +0 -129
  247. data/test/unit/parameter_matchers/has_key_test.rb +0 -55
  248. data/test/unit/parameter_matchers/has_value_test.rb +0 -57
  249. data/test/unit/parameter_matchers/includes_test.rb +0 -107
  250. data/test/unit/parameter_matchers/instance_of_test.rb +0 -25
  251. data/test/unit/parameter_matchers/is_a_test.rb +0 -25
  252. data/test/unit/parameter_matchers/kind_of_test.rb +0 -25
  253. data/test/unit/parameter_matchers/not_test.rb +0 -26
  254. data/test/unit/parameter_matchers/regexp_matches_test.rb +0 -46
  255. data/test/unit/parameter_matchers/responds_with_test.rb +0 -32
  256. data/test/unit/parameter_matchers/stub_matcher.rb +0 -27
  257. data/test/unit/parameter_matchers/yaml_equivalent_test.rb +0 -25
  258. data/test/unit/parameters_matcher_test.rb +0 -121
  259. data/test/unit/receivers_test.rb +0 -66
  260. data/test/unit/return_values_test.rb +0 -63
  261. data/test/unit/sequence_test.rb +0 -104
  262. data/test/unit/single_return_value_test.rb +0 -14
  263. data/test/unit/single_yield_test.rb +0 -18
  264. data/test/unit/state_machine_test.rb +0 -98
  265. data/test/unit/string_inspect_test.rb +0 -11
  266. data/test/unit/thrower_test.rb +0 -20
  267. data/test/unit/yield_parameters_test.rb +0 -93
  268. data/yard-templates/default/layout/html/google_analytics.erb +0 -11
  269. data/yard-templates/default/layout/html/setup.rb +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b1a4df2eb13604de6b309bc453307d375c055620
4
- data.tar.gz: 9144ebfe812beea562fc8c9ebdfb87326cb5ffa6
2
+ SHA256:
3
+ metadata.gz: d4bd89c61177f213648b496bffa016c3546d6461da8552429560ff3f9804df4f
4
+ data.tar.gz: df6603b30f57ea57f6ba3383fc80df02ce0d94b246c35dd97b3eed80e689e717
5
5
  SHA512:
6
- metadata.gz: 1cf5b923bb4a91c6b3a1dac90aca3084229955743ae64c41cbecf561e8fd572f419d09d155ff3c9b6d0616258ca526d70677d79f9861e8987f99ee5b312bbb90
7
- data.tar.gz: 9e635e0f0897d0437acffe0cfe4755ecae028da76513445a5b4b56ee48be878ae0070fa24d3fc8bddad02a69d790223909b936fdcdb6f53114feeec8c69cd3c4
6
+ metadata.gz: d3cb27ce0f13c163fb82a9ac9d3464ea3e0a2478a091033e1cb518a27db4dc4dad7ef16445a31cb363a31622b445413b132c7ffef29cc4b5c84183a7e951ec4d
7
+ data.tar.gz: ee6377fe60777af55832a284086920a4e1eff54824440f5ab4e9aa03c89e232034f0b0ec89abf5627de60c97d4f6405093144f37ec96217b31ba41ea125fd79b
@@ -0,0 +1 @@
1
+ github: floehopper
data/.rubocop.yml ADDED
@@ -0,0 +1,53 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.2 # closest to required_ruby_version of '>= 2.0'
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
+ # Kernel#__dir__ has only been available since Ruby v2.0
15
+ Style/ExpandPathArguments:
16
+ Enabled: false
17
+
18
+ # I'm not keen on this cop, because it's easy to miss the conditional
19
+ # I think the results are particularly unhelpful when Metrics/LineLength is big
20
+ Style/IfUnlessModifier:
21
+ Enabled: false
22
+
23
+ # Lambda literal syntax has only been supported since Ruby v2.0
24
+ Style/Lambda:
25
+ EnforcedStyle: lambda
26
+
27
+ # Symbol array literal syntax has only been supported since Ruby v2.0
28
+ Style/SymbolArray:
29
+ Enabled: false
30
+
31
+ # I'm not keen on this cop, because it's easy to miss the while/until
32
+ Style/WhileUntilModifier:
33
+ Enabled: false
34
+
35
+ # This recently introduced cop seems to have stirred up some controversy
36
+ Style/AccessModifierDeclarations:
37
+ Enabled: false
38
+
39
+ # This is useful when using `ExecutionPoint.current` to make tests more robust
40
+ Style/Semicolon:
41
+ Enabled: false
42
+
43
+ # Enabling this cop results in an "Infinite loop detected" exception
44
+ Layout/AccessModifierIndentation:
45
+ Enabled: false
46
+
47
+ # Allow long comment lines, e.g. YARD documentation
48
+ Metrics/LineLength:
49
+ IgnoredPatterns: ['\A\s*#']
50
+
51
+ # It's not possible to set TargetRubyVersion to Ruby < v2.2
52
+ Gemspec/RequiredRubyVersion:
53
+ 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,4 +1,4 @@
1
- --template-path yard-templates
1
+ --output-dir docs
2
2
  --no-private
3
3
  lib/mocha/api.rb
4
4
  lib/mocha/hooks.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/COPYING.md CHANGED
@@ -1,3 +1,3 @@
1
- Copyright Revieworld Ltd. 2006
1
+ Copyright James Mead 2006
2
2
 
3
- You may use, copy and redistribute this library under the same terms as [Ruby itself](http://www.ruby-lang.org/en/LICENSE.txt) or under the [MIT license](http://www.opensource.org/licenses/MIT).
3
+ You may use, copy and redistribute this library under the same terms as [Ruby itself](https://www.ruby-lang.org/en/about/license.txt) or under the [MIT license](https://mit-license.org/).
data/Gemfile CHANGED
@@ -1,3 +1,30 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ # rubocop:disable Bundler/DuplicatedGem
6
+ if RUBY_VERSION < '2.2'
7
+ gem 'rake', '~> 12.3.3'
8
+ else
9
+ gem 'rake'
10
+ end
11
+ # rubocop:enable Bundler/DuplicatedGem
12
+
13
+ gem 'introspection', '~> 0.0.1'
14
+
15
+ # Avoid breaking change in psych v4 (https://bugs.ruby-lang.org/issues/17866)
16
+ if RUBY_VERSION >= '3.1.0'
17
+ gem 'psych', '< 4'
18
+ end
19
+
20
+ if RUBY_VERSION >= '2.2.0'
21
+ # No test libraries in standard library
22
+ gem 'minitest'
23
+ end
24
+ if RUBY_VERSION >= '2.2.0'
25
+ gem 'rubocop', '<= 0.58.2'
26
+ end
27
+ if ENV['MOCHA_GENERATE_DOCS']
28
+ gem 'redcarpet'
29
+ gem 'yard'
30
+ end
data/MIT-LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006 Revieworld Ltd.
1
+ Copyright (c) 2006 James Mead
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
data/README.md CHANGED
@@ -1,13 +1,15 @@
1
- ## Mocha [![Build Status](https://travis-ci.org/freerange/mocha.svg?branch=master)](https://travis-ci.org/freerange/mocha) [![Gem Version](https://badge.fury.io/rb/mocha.png)](http://badge.fury.io/rb/mocha) [![OpenCollective](https://opencollective.com/mocha/backers/badge.svg)](#backers) [![OpenCollective](https://opencollective.com/mocha/sponsors/badge.svg)](#sponsors)
2
-
1
+ ## Mocha [![CircleCI status of freerange/mocha](https://circleci.com/gh/freerange/mocha.svg?style=shield)](https://app.circleci.com/pipelines/github/freerange/mocha) [![Gem Version](https://badge.fury.io/rb/mocha.svg)](http://badge.fury.io/rb/mocha)
3
2
 
4
3
  ### Description
5
4
 
6
- * 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).
7
6
  * A unified, simple and readable syntax for both full & partial mocking.
8
7
  * Built-in support for MiniTest and Test::Unit.
9
8
  * Supported by many other test frameworks.
10
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
+
11
13
  ### Installation
12
14
 
13
15
  #### Gem
@@ -44,35 +46,21 @@ If you're using Bundler, include Mocha in the `Gemfile` and then setup Mocha lat
44
46
 
45
47
  ```ruby
46
48
  # Gemfile
47
- gem "mocha"
49
+ gem 'mocha'
48
50
 
49
51
  # Elsewhere after Bundler has loaded gems e.g. after `require 'bundler/setup'`
50
- require "test/unit"
51
- require "mocha/test_unit"
52
+ require 'test/unit'
53
+ require 'mocha/test_unit'
52
54
  ```
53
55
 
54
56
  ##### MiniTest
55
57
 
56
58
  ```ruby
57
59
  # Gemfile
58
- gem "mocha"
59
-
60
- # Elsewhere after Bundler has loaded gems e.g. after `require 'bundler/setup'`
61
- require "minitest/unit"
62
- require "mocha/minitest"
63
- ```
64
-
65
- #### Rails
66
-
67
- 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`.
68
-
69
- ##### MiniTest
70
-
71
- ```ruby
72
- # Gemfile in Rails app
73
60
  gem 'mocha'
74
61
 
75
- # At bottom of test_helper.rb (or at least after `require 'rails/test_help'`)
62
+ # Elsewhere after Bundler has loaded gems e.g. after `require 'bundler/setup'`
63
+ require 'minitest/unit'
76
64
  require 'mocha/minitest'
77
65
  ```
78
66
 
@@ -92,30 +80,54 @@ end
92
80
 
93
81
  Note: There is no need to use a require statement to setup Mocha; RSpec does this itself.
94
82
 
95
- #### Rails Plugin
83
+ ##### Cucumber
96
84
 
97
- Install the Rails plugin...
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
+ ```
98
101
 
99
- $ rails plugin install git://github.com/freerange/mocha.git
102
+ #### Rails
100
103
 
101
- 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`.
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`.
102
105
 
103
106
  ##### MiniTest
104
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
+
105
110
  ```ruby
111
+ # Gemfile in Rails app
112
+ gem 'mocha'
113
+
106
114
  # At bottom of test_helper.rb (or at least after `require 'rails/test_help'`)
107
115
  require 'mocha/minitest'
108
116
  ```
109
117
 
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
+
110
122
  #### Known Issues
111
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.
112
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.
113
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.
114
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.
115
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.
116
129
  * 0.11.x versions don't work with Rails 3.2.13 (`TypeError: superclass mismatch for class ExpectationError`). See #115.
117
130
  * Versions 0.10.2, 0.10.3 & 0.11.0 of the Mocha gem were broken. Please do not use these versions.
118
- * Versions 0.9.6 & 0.9.7 of the Mocha Rails plugin were broken. Please do not use these versions.
119
131
 
120
132
  ### Usage
121
133
 
@@ -256,7 +268,15 @@ end
256
268
 
257
269
  ### Thread safety
258
270
 
259
- 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.
260
280
 
261
281
  ### Expectation matching / invocation order
262
282
 
@@ -264,11 +284,33 @@ Stubs and expectations are basically the same thing. A stub is just an expectati
264
284
 
265
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.
266
286
 
267
- 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.
304
+
305
+ ### Semantic versioning
306
+
307
+ * Every effort is made to comply with [semantic versioning](https://semver.org/).
308
+ * However, this only applies to the behaviour documented in the public API.
309
+ * The documented public API does *not* include the content or format of messsages displayed to the user, e.g. assertion failure messages.
268
310
 
269
311
  ### Useful Links
270
312
 
271
- * [Official Documentation](http://gofreerange.com/mocha/docs/)
313
+ * [Official Documentation](https://mocha.jamesmead.org)
272
314
  * [Source Code](http://github.com/freerange/mocha)
273
315
  * [Mailing List](http://groups.google.com/group/mocha-developer)
274
316
  * [James Mead's Blog](http://jamesmead.org/blog/)
@@ -282,107 +324,36 @@ See the [documentation](http://gofreerange.com/mocha/docs/Mocha/Mock.html) for `
282
324
 
283
325
  See this [list of contributors](https://github.com/freerange/mocha/graphs/contributors).
284
326
 
285
- ### Backers
286
-
287
- Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/mocha#backer)]
288
-
289
- <a href="https://opencollective.com/mocha/backer/0/website" target="_blank"><img src="https://opencollective.com/mocha/backer/0/avatar.svg"></a>
290
- <a href="https://opencollective.com/mocha/backer/1/website" target="_blank"><img src="https://opencollective.com/mocha/backer/1/avatar.svg"></a>
291
- <a href="https://opencollective.com/mocha/backer/2/website" target="_blank"><img src="https://opencollective.com/mocha/backer/2/avatar.svg"></a>
292
- <a href="https://opencollective.com/mocha/backer/3/website" target="_blank"><img src="https://opencollective.com/mocha/backer/3/avatar.svg"></a>
293
- <a href="https://opencollective.com/mocha/backer/4/website" target="_blank"><img src="https://opencollective.com/mocha/backer/4/avatar.svg"></a>
294
- <a href="https://opencollective.com/mocha/backer/5/website" target="_blank"><img src="https://opencollective.com/mocha/backer/5/avatar.svg"></a>
295
- <a href="https://opencollective.com/mocha/backer/6/website" target="_blank"><img src="https://opencollective.com/mocha/backer/6/avatar.svg"></a>
296
- <a href="https://opencollective.com/mocha/backer/7/website" target="_blank"><img src="https://opencollective.com/mocha/backer/7/avatar.svg"></a>
297
- <a href="https://opencollective.com/mocha/backer/8/website" target="_blank"><img src="https://opencollective.com/mocha/backer/8/avatar.svg"></a>
298
- <a href="https://opencollective.com/mocha/backer/9/website" target="_blank"><img src="https://opencollective.com/mocha/backer/9/avatar.svg"></a>
299
- <a href="https://opencollective.com/mocha/backer/10/website" target="_blank"><img src="https://opencollective.com/mocha/backer/10/avatar.svg"></a>
300
- <a href="https://opencollective.com/mocha/backer/11/website" target="_blank"><img src="https://opencollective.com/mocha/backer/11/avatar.svg"></a>
301
- <a href="https://opencollective.com/mocha/backer/12/website" target="_blank"><img src="https://opencollective.com/mocha/backer/12/avatar.svg"></a>
302
- <a href="https://opencollective.com/mocha/backer/13/website" target="_blank"><img src="https://opencollective.com/mocha/backer/13/avatar.svg"></a>
303
- <a href="https://opencollective.com/mocha/backer/14/website" target="_blank"><img src="https://opencollective.com/mocha/backer/14/avatar.svg"></a>
304
- <a href="https://opencollective.com/mocha/backer/15/website" target="_blank"><img src="https://opencollective.com/mocha/backer/15/avatar.svg"></a>
305
- <a href="https://opencollective.com/mocha/backer/16/website" target="_blank"><img src="https://opencollective.com/mocha/backer/16/avatar.svg"></a>
306
- <a href="https://opencollective.com/mocha/backer/17/website" target="_blank"><img src="https://opencollective.com/mocha/backer/17/avatar.svg"></a>
307
- <a href="https://opencollective.com/mocha/backer/18/website" target="_blank"><img src="https://opencollective.com/mocha/backer/18/avatar.svg"></a>
308
- <a href="https://opencollective.com/mocha/backer/19/website" target="_blank"><img src="https://opencollective.com/mocha/backer/19/avatar.svg"></a>
309
- <a href="https://opencollective.com/mocha/backer/20/website" target="_blank"><img src="https://opencollective.com/mocha/backer/20/avatar.svg"></a>
310
- <a href="https://opencollective.com/mocha/backer/21/website" target="_blank"><img src="https://opencollective.com/mocha/backer/21/avatar.svg"></a>
311
- <a href="https://opencollective.com/mocha/backer/22/website" target="_blank"><img src="https://opencollective.com/mocha/backer/22/avatar.svg"></a>
312
- <a href="https://opencollective.com/mocha/backer/23/website" target="_blank"><img src="https://opencollective.com/mocha/backer/23/avatar.svg"></a>
313
- <a href="https://opencollective.com/mocha/backer/24/website" target="_blank"><img src="https://opencollective.com/mocha/backer/24/avatar.svg"></a>
314
- <a href="https://opencollective.com/mocha/backer/25/website" target="_blank"><img src="https://opencollective.com/mocha/backer/25/avatar.svg"></a>
315
- <a href="https://opencollective.com/mocha/backer/26/website" target="_blank"><img src="https://opencollective.com/mocha/backer/26/avatar.svg"></a>
316
- <a href="https://opencollective.com/mocha/backer/27/website" target="_blank"><img src="https://opencollective.com/mocha/backer/27/avatar.svg"></a>
317
- <a href="https://opencollective.com/mocha/backer/28/website" target="_blank"><img src="https://opencollective.com/mocha/backer/28/avatar.svg"></a>
318
- <a href="https://opencollective.com/mocha/backer/29/website" target="_blank"><img src="https://opencollective.com/mocha/backer/29/avatar.svg"></a>
319
-
320
- ### Sponsors
321
-
322
- Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/mocha#sponsor)]
323
-
324
- <a href="https://opencollective.com/mocha/sponsor/0/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/0/avatar.svg"></a>
325
- <a href="https://opencollective.com/mocha/sponsor/1/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/1/avatar.svg"></a>
326
- <a href="https://opencollective.com/mocha/sponsor/2/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/2/avatar.svg"></a>
327
- <a href="https://opencollective.com/mocha/sponsor/3/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/3/avatar.svg"></a>
328
- <a href="https://opencollective.com/mocha/sponsor/4/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/4/avatar.svg"></a>
329
- <a href="https://opencollective.com/mocha/sponsor/5/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/5/avatar.svg"></a>
330
- <a href="https://opencollective.com/mocha/sponsor/6/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/6/avatar.svg"></a>
331
- <a href="https://opencollective.com/mocha/sponsor/7/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/7/avatar.svg"></a>
332
- <a href="https://opencollective.com/mocha/sponsor/8/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/8/avatar.svg"></a>
333
- <a href="https://opencollective.com/mocha/sponsor/9/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/9/avatar.svg"></a>
334
- <a href="https://opencollective.com/mocha/sponsor/10/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/10/avatar.svg"></a>
335
- <a href="https://opencollective.com/mocha/sponsor/11/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/11/avatar.svg"></a>
336
- <a href="https://opencollective.com/mocha/sponsor/12/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/12/avatar.svg"></a>
337
- <a href="https://opencollective.com/mocha/sponsor/13/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/13/avatar.svg"></a>
338
- <a href="https://opencollective.com/mocha/sponsor/14/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/14/avatar.svg"></a>
339
- <a href="https://opencollective.com/mocha/sponsor/15/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/15/avatar.svg"></a>
340
- <a href="https://opencollective.com/mocha/sponsor/16/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/16/avatar.svg"></a>
341
- <a href="https://opencollective.com/mocha/sponsor/17/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/17/avatar.svg"></a>
342
- <a href="https://opencollective.com/mocha/sponsor/18/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/18/avatar.svg"></a>
343
- <a href="https://opencollective.com/mocha/sponsor/19/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/19/avatar.svg"></a>
344
- <a href="https://opencollective.com/mocha/sponsor/20/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/20/avatar.svg"></a>
345
- <a href="https://opencollective.com/mocha/sponsor/21/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/21/avatar.svg"></a>
346
- <a href="https://opencollective.com/mocha/sponsor/22/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/22/avatar.svg"></a>
347
- <a href="https://opencollective.com/mocha/sponsor/23/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/23/avatar.svg"></a>
348
- <a href="https://opencollective.com/mocha/sponsor/24/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/24/avatar.svg"></a>
349
- <a href="https://opencollective.com/mocha/sponsor/25/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/25/avatar.svg"></a>
350
- <a href="https://opencollective.com/mocha/sponsor/26/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/26/avatar.svg"></a>
351
- <a href="https://opencollective.com/mocha/sponsor/27/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/27/avatar.svg"></a>
352
- <a href="https://opencollective.com/mocha/sponsor/28/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/28/avatar.svg"></a>
353
- <a href="https://opencollective.com/mocha/sponsor/29/website" target="_blank"><img src="https://opencollective.com/mocha/sponsor/29/avatar.svg"></a>
354
-
355
- ### Translations
356
-
357
- * [Serbo-Croatian](http://science.webhostinggeeks.com/mocha) by [WHG Team](http://webhostinggeeks.com/). (may be out-of-date)
358
-
359
327
  ### Releasing a new version
360
328
 
361
329
  * Update the RELEASE.md file with a summary of changes
362
330
  * Bump the version in `lib/mocha/version.rb`
363
- * Commit & push to Github
364
- * Check Travis CI build is passing - https://travis-ci.org/freerange/mocha
331
+ * Commit & push to GitHub
332
+ * Check CircleCI build is passing - https://app.circleci.com/pipelines/github/freerange/mocha
365
333
 
334
+ * Generate documentation:
335
+
336
+ ```bash
337
+ $ MOCHA_GENERATE_DOCS=true bundle install
338
+
339
+ $ MOCHA_GENERATE_DOCS=true rake generate_docs
340
+ ```
341
+ * Commit documentation & push to GitHub
366
342
  * Sign in to rubygems.org and find API key - https://rubygems.org/profile/edit
367
343
 
368
344
  ```bash
369
- $ curl -u james@floehopper.org https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials; chmod 0600 ~/.gem/credentials`
345
+ $ curl -u <email-address> -H 'OTP:<one-time-password>' https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials; chmod 0600 ~/.gem/credentials
370
346
  ```
371
347
 
372
- * Sign in to Google Analytics - https://analytics.google.com/analytics/web/
373
- * Find the web property ID for Go Free Range Ltd > Mocha Documentation (UA-45002715-2)
348
+ * Release gem to Rubygems:
374
349
 
375
350
  ```bash
376
- $ MOCHA_GENERATE_DOCS=true bundle install
377
-
378
- $ MOCHA_GENERATE_DOCS=true GOOGLE_ANALYTICS_WEB_PROPERTY_ID=UA-45002715-2 rake release
351
+ $ rake release
352
+ [runs tests]
379
353
  mocha 1.2.0 built to pkg/mocha-1.2.0.gem.
380
354
  Tagged v1.2.0.
381
355
  Pushed git commits and tags.
382
356
  Pushed mocha 1.2.0 to rubygems.org.
383
- [runs tests]
384
- [generates docs]
385
- [deploys docs]
386
357
  ```
387
358
 
388
359
  ### History
@@ -391,6 +362,6 @@ Mocha was initially harvested from projects at [Reevoo](http://www.reevoo.com/).
391
362
 
392
363
  ### License
393
364
 
394
- &copy; Copyright Revieworld Ltd. 2006
365
+ &copy; Copyright James Mead 2006
395
366
 
396
- You may use, copy and redistribute this library under the same terms as [Ruby itself](http://www.ruby-lang.org/en/LICENSE.txt) or under the [MIT license](http://www.opensource.org/licenses/MIT).
367
+ You may use, copy and redistribute this library under the same terms as [Ruby itself](https://www.ruby-lang.org/en/about/license.txt) or under the [MIT license](https://mit-license.org/).