mocha 1.12.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -13
  3. data/.yardopts +0 -1
  4. data/CONTRIBUTING.md +1 -1
  5. data/COPYING.md +2 -2
  6. data/Gemfile +27 -0
  7. data/MIT-LICENSE.md +1 -1
  8. data/README.md +12 -8
  9. data/RELEASE.md +169 -0
  10. data/Rakefile +22 -29
  11. data/gemfiles/Gemfile.minitest.latest +1 -0
  12. data/gemfiles/Gemfile.test-unit.latest +2 -5
  13. data/lib/mocha/any_instance_method.rb +0 -5
  14. data/lib/mocha/api.rb +29 -78
  15. data/lib/mocha/backtrace_filter.rb +2 -2
  16. data/lib/mocha/class_methods.rb +2 -2
  17. data/lib/mocha/configuration.rb +36 -114
  18. data/lib/mocha/debug.rb +2 -5
  19. data/lib/mocha/expectation.rb +63 -8
  20. data/lib/mocha/inspect.rb +6 -4
  21. data/lib/mocha/instance_method.rb +0 -4
  22. data/lib/mocha/integration/mini_test/adapter.rb +1 -1
  23. data/lib/mocha/integration/mini_test.rb +10 -38
  24. data/lib/mocha/integration/test_unit/adapter.rb +4 -4
  25. data/lib/mocha/integration/test_unit.rb +10 -33
  26. data/lib/mocha/invocation.rb +12 -16
  27. data/lib/mocha/minitest.rb +2 -4
  28. data/lib/mocha/mock.rb +32 -32
  29. data/lib/mocha/mockery.rb +1 -3
  30. data/lib/mocha/names.rb +1 -1
  31. data/lib/mocha/parameter_matchers/base.rb +1 -1
  32. data/lib/mocha/parameter_matchers/equivalent_uri.rb +1 -2
  33. data/lib/mocha/parameter_matchers/has_entry.rb +22 -13
  34. data/lib/mocha/parameter_matchers/has_keys.rb +53 -0
  35. data/lib/mocha/parameter_matchers/instance_methods.rb +10 -1
  36. data/lib/mocha/parameter_matchers/positional_or_keyword_hash.rb +64 -0
  37. data/lib/mocha/parameter_matchers.rb +1 -0
  38. data/lib/mocha/parameters_matcher.rb +3 -3
  39. data/lib/mocha/ruby_version.rb +1 -2
  40. data/lib/mocha/stubbed_method.rb +5 -42
  41. data/lib/mocha/test_unit.rb +2 -4
  42. data/lib/mocha/version.rb +1 -1
  43. data/lib/mocha.rb +0 -8
  44. data/mocha.gemspec +4 -29
  45. metadata +10 -87
  46. data/bin/build-matrix +0 -82
  47. data/gemfiles/Gemfile.minitest.1.3.0 +0 -7
  48. data/gemfiles/Gemfile.minitest.1.4.0 +0 -7
  49. data/gemfiles/Gemfile.minitest.1.4.1 +0 -7
  50. data/gemfiles/Gemfile.minitest.1.4.2 +0 -7
  51. data/gemfiles/Gemfile.minitest.2.0.0 +0 -7
  52. data/gemfiles/Gemfile.minitest.2.0.1 +0 -7
  53. data/gemfiles/Gemfile.minitest.2.11.0 +0 -7
  54. data/gemfiles/Gemfile.minitest.2.11.2 +0 -7
  55. data/gemfiles/Gemfile.minitest.2.3.0 +0 -7
  56. data/gemfiles/Gemfile.minitest.5.11.3 +0 -7
  57. data/gemfiles/Gemfile.test-unit.2.0.0 +0 -7
  58. data/gemfiles/Gemfile.test-unit.2.0.1 +0 -7
  59. data/gemfiles/Gemfile.test-unit.2.0.3 +0 -7
  60. data/init.rb +0 -1
  61. data/lib/mocha/integration/mini_test/nothing.rb +0 -19
  62. data/lib/mocha/integration/mini_test/version_13.rb +0 -54
  63. data/lib/mocha/integration/mini_test/version_140.rb +0 -54
  64. data/lib/mocha/integration/mini_test/version_141.rb +0 -65
  65. data/lib/mocha/integration/mini_test/version_142_to_172.rb +0 -65
  66. data/lib/mocha/integration/mini_test/version_200.rb +0 -66
  67. data/lib/mocha/integration/mini_test/version_201_to_222.rb +0 -66
  68. data/lib/mocha/integration/mini_test/version_2110_to_2111.rb +0 -70
  69. data/lib/mocha/integration/mini_test/version_2112_to_320.rb +0 -73
  70. data/lib/mocha/integration/mini_test/version_230_to_2101.rb +0 -68
  71. data/lib/mocha/integration/test_unit/gem_version_200.rb +0 -62
  72. data/lib/mocha/integration/test_unit/gem_version_201_to_202.rb +0 -62
  73. data/lib/mocha/integration/test_unit/gem_version_203_to_220.rb +0 -62
  74. data/lib/mocha/integration/test_unit/gem_version_230_to_250.rb +0 -68
  75. data/lib/mocha/integration/test_unit/nothing.rb +0 -19
  76. data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +0 -61
  77. data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +0 -63
  78. data/lib/mocha/integration.rb +0 -11
  79. data/lib/mocha/setup.rb +0 -14
  80. data/lib/mocha/singleton_class.rb +0 -9
  81. data/yard-templates/default/layout/html/google_analytics.erb +0 -8
  82. data/yard-templates/default/layout/html/setup.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3182f55b0e553eb0559fee7df5f5fd71f824e219480715de2f35e7bfacb5d9b2
4
- data.tar.gz: 485677b5a3628ccee3730274697f27defb4fc087cc838d7c4ec8dac4e3cd589d
3
+ metadata.gz: d4bd89c61177f213648b496bffa016c3546d6461da8552429560ff3f9804df4f
4
+ data.tar.gz: df6603b30f57ea57f6ba3383fc80df02ce0d94b246c35dd97b3eed80e689e717
5
5
  SHA512:
6
- metadata.gz: 1f782e0791e221f18081e35a298a039b96afd7a06caf4177a3d117e3803ee2165d9cd5dd6c19edde9334fda7dea973c105a5c3fe7070810dd0e7229901df056f
7
- data.tar.gz: 8adf5cf18b21d7039c7c8f10b4c7a49ba4a215d9351cdd89a04d7a4371eda9863727b08e5bdbb240d92dd6cc93555306b13501370ecdadd4b6a74368213851c5
6
+ metadata.gz: d3cb27ce0f13c163fb82a9ac9d3464ea3e0a2478a091033e1cb518a27db4dc4dad7ef16445a31cb363a31622b445413b132c7ffef29cc4b5c84183a7e951ec4d
7
+ data.tar.gz: ee6377fe60777af55832a284086920a4e1eff54824440f5ab4e9aa03c89e232034f0b0ec89abf5627de60c97d4f6405093144f37ec96217b31ba41ea125fd79b
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.2 # closest to required_ruby_version of '>= 1.8.6'
4
+ TargetRubyVersion: 2.2 # closest to required_ruby_version of '>= 2.0'
5
5
 
6
6
  # Even the reference in the documentation suggests that you should prefer
7
7
  # `alias_method` vs `alias`, so I don't understand why that isn't the default.
@@ -11,22 +11,10 @@ Style/Alias:
11
11
  Style/Documentation:
12
12
  Enabled: false
13
13
 
14
- # Enumerable#each_with_object only available since Ruby v1.9
15
- Style/EachWithObject:
16
- Enabled: false
17
-
18
14
  # Kernel#__dir__ has only been available since Ruby v2.0
19
15
  Style/ExpandPathArguments:
20
16
  Enabled: false
21
17
 
22
- # Kernel#format has only supported named references since Ruby v1.9
23
- Style/FormatStringToken:
24
- EnforcedStyle: unannotated
25
-
26
- # ruby19 style has only been supported since Ruby v1.9
27
- Style/HashSyntax:
28
- EnforcedStyle: hash_rockets
29
-
30
18
  # I'm not keen on this cop, because it's easy to miss the conditional
31
19
  # I think the results are particularly unhelpful when Metrics/LineLength is big
32
20
  Style/IfUnlessModifier:
@@ -48,6 +36,10 @@ Style/WhileUntilModifier:
48
36
  Style/AccessModifierDeclarations:
49
37
  Enabled: false
50
38
 
39
+ # This is useful when using `ExecutionPoint.current` to make tests more robust
40
+ Style/Semicolon:
41
+ Enabled: false
42
+
51
43
  # Enabling this cop results in an "Infinite loop detected" exception
52
44
  Layout/AccessModifierIndentation:
53
45
  Enabled: false
data/.yardopts CHANGED
@@ -1,5 +1,4 @@
1
1
  --output-dir docs
2
- --template-path yard-templates
3
2
  --no-private
4
3
  lib/mocha/api.rb
5
4
  lib/mocha/hooks.rb
data/CONTRIBUTING.md CHANGED
@@ -3,5 +3,5 @@
3
3
  * Make your changes in a branch.
4
4
  * Add/modify/remove tests as appropriate.
5
5
  * Open a pull request based on a branch on your fork.
6
- * Wait for your pull request build to pass on [Travis CI](https://travis-ci.com/github/freerange/mocha/pull_requests).
6
+ * Wait for your pull request build to pass on [Circle CI](https://app.circleci.com/pipelines/github/freerange/mocha).
7
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,4 +1,4 @@
1
- ## Mocha [![Build Status](https://travis-ci.com/freerange/mocha.svg?branch=main)](https://travis-ci.com/github/freerange/mocha) [![Gem Version](https://badge.fury.io/rb/mocha.svg)](http://badge.fury.io/rb/mocha) [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=mocha&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=mocha&package-manager=bundler&version-scheme=semver)
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)
2
2
 
3
3
  ### Description
4
4
 
@@ -302,6 +302,12 @@ See the [documentation](https://mocha.jamesmead.org/Mocha/Configuration.html) fo
302
302
  Only the following values are currently recognized and have an effect:
303
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
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.
310
+
305
311
  ### Useful Links
306
312
 
307
313
  * [Official Documentation](https://mocha.jamesmead.org)
@@ -323,22 +329,20 @@ See this [list of contributors](https://github.com/freerange/mocha/graphs/contri
323
329
  * Update the RELEASE.md file with a summary of changes
324
330
  * Bump the version in `lib/mocha/version.rb`
325
331
  * Commit & push to GitHub
326
- * Check Travis CI build is passing - https://travis-ci.com/github/freerange/mocha
332
+ * Check CircleCI build is passing - https://app.circleci.com/pipelines/github/freerange/mocha
327
333
 
328
- * Sign in to Google Analytics - https://analytics.google.com/analytics/web/
329
- * Find the web property ID for floehopper (625523) > Mocha Documentation (UA-625523-7)
330
334
  * Generate documentation:
331
335
 
332
336
  ```bash
333
337
  $ MOCHA_GENERATE_DOCS=true bundle install
334
338
 
335
- $ MOCHA_GENERATE_DOCS=true GOOGLE_ANALYTICS_WEB_PROPERTY_ID=UA-625523-7 rake generate_docs
339
+ $ MOCHA_GENERATE_DOCS=true rake generate_docs
336
340
  ```
337
341
  * Commit documentation & push to GitHub
338
342
  * Sign in to rubygems.org and find API key - https://rubygems.org/profile/edit
339
343
 
340
344
  ```bash
341
- $ 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
342
346
  ```
343
347
 
344
348
  * Release gem to Rubygems:
@@ -358,6 +362,6 @@ Mocha was initially harvested from projects at [Reevoo](http://www.reevoo.com/).
358
362
 
359
363
  ### License
360
364
 
361
- &copy; Copyright Revieworld Ltd. 2006
365
+ &copy; Copyright James Mead 2006
362
366
 
363
- 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/).
data/RELEASE.md CHANGED
@@ -1,5 +1,174 @@
1
1
  # Release Notes
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### External changes
6
+
7
+ * Fix compatibility with Minitest (#614) - thanks to @kyrofa & @manewitz for reporting and to @zenspider for his input
8
+
9
+ ### Internal changes
10
+
11
+ * Update URLs for links to Ruby & MIT licenses (d6470af4)
12
+
13
+ ## 2.0.4
14
+
15
+ ### Internal changes
16
+
17
+ * Update `README.md` (e8c21e1b)
18
+
19
+ ## 2.0.3
20
+
21
+ ### External changes
22
+
23
+ * Fix `BacktraceFilter` to handle special characters (e242033f, #592) - thanks to @casperisfine
24
+
25
+ ### Internal changes
26
+
27
+ * Add Ruby v3.1 to the CircleCI build (3e460489)
28
+ * DRY up `regexp_matches` test (ae9fed4a)
29
+ * Fix regexp_matches tests in Ruby v3.2 (26b106a5, #590)
30
+ * Use Ruby 1.9 hash syntax (8bc0ad2f, #598, #537) - thanks to @herwinw
31
+ * Simplify storage of `MOCHA_OPTIONS` (b70507a1, #600) - thanks to @herwinw
32
+ * Pin JRuby to v9.3.9.0 in CircleCI builds (b8e6d064, #591)
33
+ * Rubocop: enable Style/FormatStringToken cop (089a688e, #603) - thanks to @herwinw
34
+ * Remove Ruby version check from `RespondsLikeTest` (21583129)
35
+ * Add Ruby v3.2 to CircleCI build (f7e17636, #601)
36
+ * Use Ruby v2.6 vs v2.2 to run lint CI job (af40b7db)
37
+ * Pin yard version to v0.9.28 to avoid `ArgumentError` (12f1eef7)
38
+ * Revert "Pin JRuby to v9.3.9.0 in CircleCI builds" (4f5bb2f0, #591)
39
+ * Remove invalid CircleCI token from badge URL (7078e76a)
40
+ * Revert "Pin yard version to v0.9.28 to avoid ArgumentError" (7c6c10c5, #609)
41
+ * Remove Google Analytics tracking code (2279c49d, #612)
42
+ * Update `MIT-LICENSE.md` (48162b4e)
43
+ * Update `COPYING.md` (f3152376)
44
+
45
+ ## 2.0.2
46
+
47
+ ### External changes
48
+
49
+ * Fix regression in `Mock#responds_like` behaviour - thanks to @adrianna-chang-shopify for reporting (#580,#583,ba4d619e)
50
+
51
+ ## 2.0.1
52
+
53
+ ### External changes
54
+
55
+ * Fix `LoadError` when using v2.0.0 with Ruby < v2.7 by moving declaration of runtime dependency on `ruby2_keywords` gem from `Gemfile` to `mocha.gemspec` - thanks to @mishina2228 for reporting (#581, #582, cdeb0356)
56
+
57
+ ## 2.0.0
58
+
59
+ ### External changes
60
+
61
+ * Remove support for Ruby v1.9 - thanks to @wasabigeek (#552)
62
+ * Support strict keyword argument matching - see docs for `Expectation#with` & `Configuration#strict_keyword_argument_matching=` - thanks to @wasabigeek (#446,#535,#544,#562)
63
+ * Deprecate `Hash` args that don't strictly match (#563,981c31be)
64
+ * Drop support for older versions of test-unit - gem versions of test-unit earlier than v2.5.1 and versions of test-unit
65
+ from the Ruby v1.8 standard library are no longer supported (#540,969f4845)
66
+ * Drop support for older versions of minitest - versions of minitest earlier than v3.3.0 are no longer supported (#541,ca69dc9e)
67
+ * Remove deprecated `mocha/setup.rb` mechanism (642a0ff4)
68
+ * Add missing docs for `API#stub` parameter (257b4cb4)
69
+ * Remove optional reinstatement of v1.9 behaviour (#436,#438,#569,1473ee25)
70
+ * Remove deprecated methods in `Configuration` (#421,e7ff7528)
71
+ * Fail fast when mock receives invocations in another test (#440,#442,cb054d59)
72
+ * Improve docs re using matchers in `Expectation#with` (da7237cd)
73
+ * Expand `Expectation#with` docs re keyword arguments (fed6808d)
74
+ * Improve docs for `strict_keyword_argument_matching` (8d8f881d)
75
+ * Remove deprecated Rails plugin `init.rb` file (1c617175)
76
+ * Improve strict keyword argument matching deprecation warning by including the source location of the stub definition (77c0d4cc)
77
+ * Add README section re semantic versioning (00758246)
78
+
79
+ ### Internal changes
80
+
81
+ * Separate linting from tests in terms of Rake tasks & CircleCI jobs - thanks to @wasabigeek (#556)
82
+ * Remove tests specific to Ruby v1.8 behaviour (46fca7ac, 3b369e99)
83
+ * Multi-line rubocop disable in `Mock#method_missing` (af2194c4)
84
+ * Remove unused arg for `HashMethods#mocha_inspect` (4f59e27f)
85
+ * Improve test runner assertions - failure vs error (eec7200a)
86
+ * Improve test coverage of `PositionalOrKeywordHash` (c294fe70)
87
+ * More consistent Test::Unit & Minitest integration (27dd3817)
88
+ * Remove redundant `require` statements (d82218a8,fa17b114)
89
+ * Add missing `require` statement (73493761)
90
+ * Disable Style/Semicolon cop globally (8cd0b705)
91
+
92
+ ## 1.16.1
93
+
94
+ ### External changes
95
+
96
+ * Fix regression in `Mock#responds_like` behaviour - thanks to @adrianna-chang-shopify for reporting (#580,#583,77af2af1)
97
+
98
+ ## 1.16.0
99
+
100
+ ### External changes
101
+
102
+ * Default `Configuration#reinstate_undocumented_behaviour_from_v1_9=` to `false` (6fcaf947)
103
+ * Deprecate `Configuration#reinstate_undocumented_behaviour_from_v1_9=` (a797c5fd)
104
+
105
+ ### Internal changes
106
+
107
+ * Remove redundant deprecation disabling in MockTest (dc8ca969)
108
+
109
+ ## 1.15.1
110
+
111
+ ### External changes
112
+
113
+ * Fix regression in `Mock#responds_like` behaviour - thanks to @adrianna-chang-shopify for reporting (#580,#583,c586a08c)
114
+
115
+ ## 1.15.0
116
+
117
+ ### External changes
118
+
119
+ * Fix examples using mock constructor with block (1cc17667)
120
+ * Add another example for `API#sequence` (b7a7d233, #59)
121
+ * Remove support for Ruby v1.8 (ddb5d672)
122
+ * Deprecate support for Ruby versions earlier than v2.0 - thanks to @wasabigeek (#553, #555)
123
+
124
+ ### Internal changes
125
+
126
+ * Update instructions for obtaining Rubygems API key (ed9c040a)
127
+ * Consistent definitions for `respond_to?` methods (#533)
128
+ * Run test tasks before release tasks (92a1bc6e, #447)
129
+ * Fix test:performance Rake task (#538, #539)
130
+ * Tidying following removal of support for Ruby v1.8 - thanks to @nitishr (#542)
131
+ * Remove `ParametersMatcher` from `Invocation#call_description` - thanks to @wasabigeek (#543)
132
+ * Remove unnecessary splatting in Invocation - thanks to @wasabigeek (#549)
133
+ * Extract `handle_method_call` from `method_missing` - thanks to @wasabigeek (#550)
134
+
135
+ ## 1.14.0
136
+
137
+ ### External changes
138
+
139
+ * Mock#expects,#stubs should return last expectation - thanks to @vlad-pisanov for #524 (b6b637db)
140
+
141
+ ### Internal changes
142
+
143
+ * Avoid breaking change in psych v4 in ruby v3.1 (08b9f4ca)
144
+ * Remove broken Dependabot badge from README (d446657a)
145
+ * Add Ruby 3.0 to the CI matrix - thanks to @mishina2228 for #526 (65bc626e)
146
+ * Move development dependencies from gemspec to Gemfile - thanks to @mishina2228 for #527 (dd127f7b)
147
+
148
+ ## 1.13.0
149
+
150
+ ### External changes
151
+
152
+ * Add `ParameterMatchers#has_keys` - thanks to @cstyles for #512 (18d8104)
153
+ * Fix misleading exception message in `ParameterMatchers#has_entry` - thanks to @cstyles for #513 (9c4ef13)
154
+ * Only add dependency on rubocop if we're actually going to use it (f2f879f)
155
+ * Fix rake dependency constraints for older Ruby versions (7ce5f29)
156
+
157
+ ### Internal changes
158
+
159
+ * Check documentation can be generated as part of CircleCI build (b30d9a9)
160
+ * Add --fail-on-warning option to yard rake task (53a6ee3)
161
+ * Add a weekly scheduled build to the CircleCI build (fd2a4c6)
162
+ * Add Ruby v1.8 to the CircleCI build matrix (818ca03)
163
+ * Add API token to fix CircleCI badge in README (607c5aa)
164
+ * Provide wrapped option for #mocha_inspect on hashes & arrays (d8f44bc)
165
+ * Use CircleCI instead of TravisCI for automated builds (c98c6ec)
166
+ * Switch to newer default Travis CI build env (c78f75c)
167
+ * Use latest Ruby versions in Travis CI builds (9e0043a)
168
+ * Use latest JRuby v9.2.18 in Travis CI builds (8c99a1b)
169
+ * Use consistent JRuby versions in Travis CI builds (0f849aa)
170
+ * Use more recent version of JRuby in Travis CI build matrix (58653db)
171
+
3
172
  ## 1.12.0
4
173
 
5
174
  ### External changes
data/Rakefile CHANGED
@@ -1,11 +1,18 @@
1
1
  require 'bundler'
2
- Bundler::GemHelper.install_tasks
2
+ namespace 'rubygems' do
3
+ Bundler::GemHelper.install_tasks
4
+ end
3
5
  require 'bundler/setup'
4
6
 
5
7
  require 'rake/testtask'
8
+ begin
9
+ # Only available with default Gemfile and in Ruby >= v2.2
10
+ require 'rubocop/rake_task'
11
+ rescue LoadError # rubocop:disable Lint/HandleExceptions
12
+ end
6
13
 
7
- desc 'Run all tests'
8
- task 'default' => ['test', 'test:performance']
14
+ desc 'Run all linters and tests'
15
+ task 'default' => ['lint', 'test', 'test:performance']
9
16
 
10
17
  desc 'Run tests'
11
18
  task 'test' do
@@ -18,15 +25,10 @@ task 'test' do
18
25
  end
19
26
 
20
27
  namespace 'test' do # rubocop:disable Metrics/BlockLength
21
- unit_tests = FileList['test/unit/**/*_test.rb']
22
- all_acceptance_tests = FileList['test/acceptance/*_test.rb']
23
- ruby186_incompatible_acceptance_tests = FileList['test/acceptance/stub_class_method_defined_on_*_test.rb'] + FileList['test/acceptance/stub_instance_method_defined_on_*_test.rb']
24
- ruby186_compatible_acceptance_tests = all_acceptance_tests - ruby186_incompatible_acceptance_tests
25
-
26
28
  desc 'Run unit tests'
27
29
  Rake::TestTask.new('units') do |t|
28
30
  t.libs << 'test'
29
- t.test_files = unit_tests
31
+ t.test_files = FileList['test/unit/**/*_test.rb']
30
32
  t.verbose = true
31
33
  t.warning = true
32
34
  end
@@ -34,11 +36,7 @@ namespace 'test' do # rubocop:disable Metrics/BlockLength
34
36
  desc 'Run acceptance tests'
35
37
  Rake::TestTask.new('acceptance') do |t|
36
38
  t.libs << 'test'
37
- t.test_files = if defined?(RUBY_VERSION) && (RUBY_VERSION >= '1.8.7')
38
- all_acceptance_tests
39
- else
40
- ruby186_compatible_acceptance_tests
41
- end
39
+ t.test_files = FileList['test/acceptance/*_test.rb']
42
40
  t.verbose = true
43
41
  t.warning = true
44
42
  end
@@ -83,13 +81,13 @@ namespace 'test' do # rubocop:disable Metrics/BlockLength
83
81
  end
84
82
  end
85
83
 
86
- begin
87
- require 'rubocop/rake_task'
88
- if RUBY_VERSION >= '2.2.0' && (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby') && ENV['MOCHA_RUN_INTEGRATION_TESTS'].nil?
84
+ task 'lint' do
85
+ if defined?(RuboCop::RakeTask)
89
86
  RuboCop::RakeTask.new
90
- task 'test' => 'rubocop'
87
+ Rake::Task['rubocop'].invoke
88
+ else
89
+ puts 'RuboCop not available - skipping linting'
91
90
  end
92
- rescue LoadError # rubocop:disable Lint/HandleExceptions
93
91
  end
94
92
 
95
93
  # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
@@ -100,6 +98,7 @@ def benchmark_test_case(klass, iterations)
100
98
  if defined?(MiniTest)
101
99
  minitest_version = Gem::Version.new(Mocha::Detection::MiniTest.version)
102
100
  if Gem::Requirement.new('>= 5.0.0').satisfied_by?(minitest_version)
101
+ Minitest.seed = 1
103
102
  result = Benchmark.realtime { iterations.times { |_i| klass.run(MiniTest::CompositeReporter.new) } }
104
103
  MiniTest::Runnable.runnables.delete(klass)
105
104
  result
@@ -112,7 +111,7 @@ def benchmark_test_case(klass, iterations)
112
111
  unless @silent_option
113
112
  begin
114
113
  load 'test/unit/ui/console/outputlevel.rb' unless defined?(Test::Unit::UI::Console::OutputLevel::SILENT)
115
- @silent_option = { :output_level => Test::Unit::UI::Console::OutputLevel::SILENT }
114
+ @silent_option = { output_level: Test::Unit::UI::Console::OutputLevel::SILENT }
116
115
  rescue LoadError
117
116
  @silent_option = Test::Unit::UI::SILENT
118
117
  end
@@ -130,15 +129,9 @@ if ENV['MOCHA_GENERATE_DOCS']
130
129
  `rm -rf ./docs`
131
130
  end
132
131
 
133
- task 'docs_environment' do
134
- unless ENV['GOOGLE_ANALYTICS_WEB_PROPERTY_ID']
135
- puts "\nWarning: GOOGLE_ANALYTICS_WEB_PROPERTY_ID was not defined\n\n"
136
- end
137
- end
138
-
139
132
  desc 'Generate documentation'
140
- YARD::Rake::YardocTask.new('yardoc' => 'docs_environment') do |task|
141
- task.options = ['--title', "Mocha #{Mocha::VERSION}"]
133
+ YARD::Rake::YardocTask.new('yardoc') do |task|
134
+ task.options = ['--title', "Mocha #{Mocha::VERSION}", '--fail-on-warning']
142
135
  end
143
136
 
144
137
  task 'checkout_docs_cname' do
@@ -154,4 +147,4 @@ if ENV['MOCHA_GENERATE_DOCS']
154
147
  task 'generate_docs' => %w[clobber_yardoc yardoc checkout_docs_cname checkout_docs_js]
155
148
  end
156
149
 
157
- task 'release' => 'default'
150
+ task 'release' => ['default', 'rubygems:release']
@@ -3,5 +3,6 @@ source 'https://rubygems.org'
3
3
  gemspec :path=>"../"
4
4
 
5
5
  group :development do
6
+ gem "rake"
6
7
  gem "minitest"
7
8
  end
@@ -3,9 +3,6 @@ source 'https://rubygems.org'
3
3
  gemspec :path=>"../"
4
4
 
5
5
  group :development do
6
- if RUBY_VERSION < '1.9'
7
- gem "test-unit", "~> 2"
8
- else
9
- gem "test-unit"
10
- end
6
+ gem "rake"
7
+ gem "test-unit"
11
8
  end
@@ -1,4 +1,3 @@
1
- require 'mocha/ruby_version'
2
1
  require 'mocha/stubbed_method'
3
2
 
4
3
  module Mocha
@@ -9,10 +8,6 @@ module Mocha
9
8
  stubbee.any_instance
10
9
  end
11
10
 
12
- def method_body(method)
13
- method
14
- end
15
-
16
11
  def stubbee_method(method_name)
17
12
  stubbee.instance_method(method_name)
18
13
  end