mocha 1.8.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -3
  3. data/RELEASE.md +10 -0
  4. data/bin/build-matrix +1 -2
  5. data/docs/Mocha.html +3 -3
  6. data/docs/Mocha/API.html +3 -3
  7. data/docs/Mocha/ClassMethods.html +3 -3
  8. data/docs/Mocha/Configuration.html +3 -3
  9. data/docs/Mocha/Expectation.html +3 -3
  10. data/docs/Mocha/ExpectationError.html +3 -3
  11. data/docs/Mocha/ExpectationErrorFactory.html +3 -3
  12. data/docs/Mocha/Hooks.html +3 -3
  13. data/docs/Mocha/Integration.html +3 -3
  14. data/docs/Mocha/Integration/MiniTest.html +3 -3
  15. data/docs/Mocha/Integration/MiniTest/Adapter.html +3 -3
  16. data/docs/Mocha/Integration/TestUnit.html +3 -3
  17. data/docs/Mocha/Integration/TestUnit/Adapter.html +3 -3
  18. data/docs/Mocha/Mock.html +3 -3
  19. data/docs/Mocha/ObjectMethods.html +3 -3
  20. data/docs/Mocha/ParameterMatchers.html +3 -3
  21. data/docs/Mocha/ParameterMatchers/AllOf.html +3 -3
  22. data/docs/Mocha/ParameterMatchers/AnyOf.html +3 -3
  23. data/docs/Mocha/ParameterMatchers/AnyParameters.html +3 -3
  24. data/docs/Mocha/ParameterMatchers/Anything.html +3 -3
  25. data/docs/Mocha/ParameterMatchers/Base.html +3 -3
  26. data/docs/Mocha/ParameterMatchers/Equals.html +3 -3
  27. data/docs/Mocha/ParameterMatchers/EquivalentUri.html +3 -3
  28. data/docs/Mocha/ParameterMatchers/HasEntries.html +3 -3
  29. data/docs/Mocha/ParameterMatchers/HasEntry.html +3 -3
  30. data/docs/Mocha/ParameterMatchers/HasKey.html +3 -3
  31. data/docs/Mocha/ParameterMatchers/HasValue.html +3 -3
  32. data/docs/Mocha/ParameterMatchers/Includes.html +3 -3
  33. data/docs/Mocha/ParameterMatchers/InstanceOf.html +3 -3
  34. data/docs/Mocha/ParameterMatchers/IsA.html +3 -3
  35. data/docs/Mocha/ParameterMatchers/KindOf.html +3 -3
  36. data/docs/Mocha/ParameterMatchers/Not.html +3 -3
  37. data/docs/Mocha/ParameterMatchers/Optionally.html +3 -3
  38. data/docs/Mocha/ParameterMatchers/RegexpMatches.html +3 -3
  39. data/docs/Mocha/ParameterMatchers/RespondsWith.html +3 -3
  40. data/docs/Mocha/ParameterMatchers/YamlEquivalent.html +3 -3
  41. data/docs/Mocha/Sequence.html +3 -3
  42. data/docs/Mocha/StateMachine.html +3 -3
  43. data/docs/Mocha/StateMachine/State.html +3 -3
  44. data/docs/Mocha/StateMachine/StatePredicate.html +3 -3
  45. data/docs/Mocha/StubbingError.html +3 -3
  46. data/docs/Mocha/UnexpectedInvocation.html +3 -3
  47. data/docs/_index.html +4 -4
  48. data/docs/file.COPYING.html +3 -3
  49. data/docs/file.MIT-LICENSE.html +3 -3
  50. data/docs/file.README.html +14 -6
  51. data/docs/file.RELEASE.html +15 -3
  52. data/docs/frames.html +1 -1
  53. data/docs/index.html +14 -6
  54. data/docs/js/app.js +11 -0
  55. data/docs/top-level-namespace.html +3 -3
  56. data/lib/mocha/any_instance_method.rb +17 -43
  57. data/lib/mocha/class_method.rb +79 -45
  58. data/lib/mocha/version.rb +1 -1
  59. data/test/unit/any_instance_method_test.rb +24 -0
  60. data/test/unit/class_method_test.rb +22 -0
  61. metadata +3 -5
  62. data/docs/CNAME +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0c0293e3246e6c08b3091803488531187ef47253ec22fbcd0b48921e401aa9e
4
- data.tar.gz: 34c50006ebf871ed458dd97d2057caeeca9ae329a41da8d9abeb8e818a9f7042
3
+ metadata.gz: e1d0e385d6aa624c452c0d2e0eb61d9654b95db083371ff2ea3ea942c4ca7826
4
+ data.tar.gz: 823ab524717c9fd84d55e9b8be08e583cd183a0dc1b30e7d8f6e7cc8e7739f98
5
5
  SHA512:
6
- metadata.gz: d3004d3ac125a41336d2138c35cf581cb05c51b96b7ecd895422715e84db62dca230ad96828c2a8c5f08b7ac0e00d0721aee20a8d17f6ef88b810c0b025bae3b
7
- data.tar.gz: 3dab739556bbab55d0ded0fb0f81368a7b17f3cc5a635e65a9b5c5e6c9a5b2700f0b4f1d15db887fd8b477d89b28f8147382a4403589de265a6c6e7335adc724
6
+ metadata.gz: 404f70ce4517676e56def76d6d21c5d0039afdcfcf46d976162b8c2d50c35c5d4e28a075b84c16481c40574553bda5482b61b5a54118f430b792f7db9bdaa479
7
+ data.tar.gz: 439b05b74aa97d6a87288f6477e0caa4c78bf92c2b3942027662d64d9ca631c630f085201d6e79b936b8e6ac70565dfd8be7e9897820f69f3e84b9642919648f
data/README.md CHANGED
@@ -256,7 +256,15 @@ end
256
256
 
257
257
  ### Thread safety
258
258
 
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.
259
+ Mocha currently *does not* attempt to be thread-safe.
260
+
261
+ #### Can I test multi-threaded code with Mocha?
262
+
263
+ 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.
264
+
265
+ #### Can I run my tests across multiple threads?
266
+
267
+ 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
268
 
261
269
  ### Expectation matching / invocation order
262
270
 
@@ -301,13 +309,13 @@ See this [list of contributors](https://github.com/freerange/mocha/graphs/contri
301
309
  * Check Travis CI build is passing - https://travis-ci.org/freerange/mocha
302
310
 
303
311
  * Sign in to Google Analytics - https://analytics.google.com/analytics/web/
304
- * Find the web property ID for Go Free Range Ltd > Mocha Documentation (UA-45002715-2)
312
+ * Find the web property ID for Go Free Range Ltd > Mocha Documentation (UA-625523-7)
305
313
  * Generate documentation:
306
314
 
307
315
  ```bash
308
316
  $ MOCHA_GENERATE_DOCS=true bundle install
309
317
 
310
- $ MOCHA_GENERATE_DOCS=true GOOGLE_ANALYTICS_WEB_PROPERTY_ID=UA-45002715-2 rake generate_docs
318
+ $ MOCHA_GENERATE_DOCS=true GOOGLE_ANALYTICS_WEB_PROPERTY_ID=UA-625523-7 rake generate_docs
311
319
  ```
312
320
  * Commit documentation & push to GitHub
313
321
  * Sign in to rubygems.org and find API key - https://rubygems.org/profile/edit
data/RELEASE.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Release Notes
2
2
 
3
+ ## 1.9.0
4
+
5
+ * Add TruffleRuby to Travis CI build matrix - thanks to @deepj (#354)
6
+ * Explicitly set Travis CI OS to Ubuntu Trusty 14.04 (ded1fa45)
7
+ * Expand explanation of thread-safety concerns - thanks to @techbelly (#357)
8
+ * Refactor class method and any instance method - thanks to @chrisroos (#358)
9
+ * Rely on default bundler version in Travis CI builds (3352e9c5)
10
+ * Fix local build-matrix script (11abe231)
11
+ * No need to install latest bundler in build-matrix script (8247a894)
12
+
3
13
  ## 1.8.0
4
14
 
5
15
  * Constrain rubocop version to avoid breaking Travis CI builds (05e507f5)
@@ -36,7 +36,6 @@ def run(ruby_version, gemfile, task = 'test')
36
36
  ENV['MOCHA_OPTIONS'] = 'debug'
37
37
  reset_bundle
38
38
  execute(
39
- with_rbenv('gem update bundler --force --no-post-install-message'),
40
39
  with_rbenv("bundle install --gemfile=#{gemfile}"),
41
40
  with_rbenv("bundle exec rake #{task}")
42
41
  )
@@ -80,4 +79,4 @@ build_configs.each do |config|
80
79
  end
81
80
  end
82
81
 
83
- puts "Missing Ruby versions: #{missing_ruby_versions.join(', ')}"
82
+ puts "Missing Ruby versions: #{missing_ruby_versions.to_a.join(', ')}"
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Mocha
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -117,9 +117,9 @@
117
117
  </div>
118
118
 
119
119
  <div id="footer">
120
- Generated on Tue Jan 15 17:13:05 2019 by
120
+ Generated on Mon Jun 17 18:38:43 2019 by
121
121
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
122
- 0.9.16 (ruby-2.5.3).
122
+ 0.9.19 (ruby-2.5.3).
123
123
  </div>
124
124
 
125
125
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Mocha::API
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -1046,9 +1046,9 @@ receiver instead.

1046
1046
  </div>
1047
1047
 
1048
1048
  <div id="footer">
1049
- Generated on Tue Jan 15 17:13:05 2019 by
1049
+ Generated on Mon Jun 17 18:38:43 2019 by
1050
1050
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1051
- 0.9.16 (ruby-2.5.3).
1051
+ 0.9.19 (ruby-2.5.3).
1052
1052
  </div>
1053
1053
 
1054
1054
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Mocha::ClassMethods
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -257,9 +257,9 @@ class.

257
257
  </div>
258
258
 
259
259
  <div id="footer">
260
- Generated on Tue Jan 15 17:13:05 2019 by
260
+ Generated on Mon Jun 17 18:38:43 2019 by
261
261
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
262
- 0.9.16 (ruby-2.5.3).
262
+ 0.9.19 (ruby-2.5.3).
263
263
  </div>
264
264
 
265
265
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: Mocha::Configuration
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -616,9 +616,9 @@ being returned to its original value at the end of the block.

616
616
  </div>
617
617
 
618
618
  <div id="footer">
619
- Generated on Tue Jan 15 17:13:06 2019 by
619
+ Generated on Mon Jun 17 18:38:45 2019 by
620
620
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
621
- 0.9.16 (ruby-2.5.3).
621
+ 0.9.19 (ruby-2.5.3).
622
622
  </div>
623
623
 
624
624
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: Mocha::Expectation
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -2699,9 +2699,9 @@ methods to be chained.

2699
2699
  </div>
2700
2700
 
2701
2701
  <div id="footer">
2702
- Generated on Tue Jan 15 17:13:06 2019 by
2702
+ Generated on Mon Jun 17 18:38:44 2019 by
2703
2703
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2704
- 0.9.16 (ruby-2.5.3).
2704
+ 0.9.19 (ruby-2.5.3).
2705
2705
  </div>
2706
2706
 
2707
2707
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Exception: Mocha::ExpectationError
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -147,9 +147,9 @@ exception.

147
147
  </div>
148
148
 
149
149
  <div id="footer">
150
- Generated on Tue Jan 15 17:13:06 2019 by
150
+ Generated on Mon Jun 17 18:38:45 2019 by
151
151
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
152
- 0.9.16 (ruby-2.5.3).
152
+ 0.9.19 (ruby-2.5.3).
153
153
  </div>
154
154
 
155
155
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: Mocha::ExpectationErrorFactory
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -259,9 +259,9 @@ invocation or an unsatisfied expectation.

259
259
  </div>
260
260
 
261
261
  <div id="footer">
262
- Generated on Tue Jan 15 17:13:06 2019 by
262
+ Generated on Mon Jun 17 18:38:45 2019 by
263
263
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
264
- 0.9.16 (ruby-2.5.3).
264
+ 0.9.19 (ruby-2.5.3).
265
265
  </div>
266
266
 
267
267
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Mocha::Hooks
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -375,9 +375,9 @@ has been determined whether or not the test has passed.

375
375
  </div>
376
376
 
377
377
  <div id="footer">
378
- Generated on Tue Jan 15 17:13:05 2019 by
378
+ Generated on Mon Jun 17 18:38:43 2019 by
379
379
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
380
- 0.9.16 (ruby-2.5.3).
380
+ 0.9.19 (ruby-2.5.3).
381
381
  </div>
382
382
 
383
383
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Mocha::Integration
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -115,9 +115,9 @@
115
115
  </div>
116
116
 
117
117
  <div id="footer">
118
- Generated on Tue Jan 15 17:13:06 2019 by
118
+ Generated on Mon Jun 17 18:38:43 2019 by
119
119
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
120
- 0.9.16 (ruby-2.5.3).
120
+ 0.9.19 (ruby-2.5.3).
121
121
  </div>
122
122
 
123
123
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Mocha::Integration::MiniTest
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -113,9 +113,9 @@
113
113
  </div>
114
114
 
115
115
  <div id="footer">
116
- Generated on Tue Jan 15 17:13:06 2019 by
116
+ Generated on Mon Jun 17 18:38:43 2019 by
117
117
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
118
- 0.9.16 (ruby-2.5.3).
118
+ 0.9.19 (ruby-2.5.3).
119
119
  </div>
120
120
 
121
121
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Mocha::Integration::MiniTest::Adapter
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -155,9 +155,9 @@ library.

155
155
  </div>
156
156
 
157
157
  <div id="footer">
158
- Generated on Tue Jan 15 17:13:06 2019 by
158
+ Generated on Mon Jun 17 18:38:43 2019 by
159
159
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
160
- 0.9.16 (ruby-2.5.3).
160
+ 0.9.19 (ruby-2.5.3).
161
161
  </div>
162
162
 
163
163
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Mocha::Integration::TestUnit
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -113,9 +113,9 @@
113
113
  </div>
114
114
 
115
115
  <div id="footer">
116
- Generated on Tue Jan 15 17:13:06 2019 by
116
+ Generated on Mon Jun 17 18:38:43 2019 by
117
117
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
118
- 0.9.16 (ruby-2.5.3).
118
+ 0.9.19 (ruby-2.5.3).
119
119
  </div>
120
120
 
121
121
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Mocha::Integration::TestUnit::Adapter
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -155,9 +155,9 @@ library.

155
155
  </div>
156
156
 
157
157
  <div id="footer">
158
- Generated on Tue Jan 15 17:13:06 2019 by
158
+ Generated on Mon Jun 17 18:38:43 2019 by
159
159
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
160
- 0.9.16 (ruby-2.5.3).
160
+ 0.9.19 (ruby-2.5.3).
161
161
  </div>
162
162
 
163
163
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: Mocha::Mock
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -1187,9 +1187,9 @@ object.stubbed_method # => unexpected invocation: #<Mock:mock>.stubbed_
1187
1187
  </div>
1188
1188
 
1189
1189
  <div id="footer">
1190
- Generated on Tue Jan 15 17:13:06 2019 by
1190
+ Generated on Mon Jun 17 18:38:44 2019 by
1191
1191
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1192
- 0.9.16 (ruby-2.5.3).
1192
+ 0.9.19 (ruby-2.5.3).
1193
1193
  </div>
1194
1194
 
1195
1195
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Mocha::ObjectMethods
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -702,9 +702,9 @@ satisfied. Use
702
702
  </div>
703
703
 
704
704
  <div id="footer">
705
- Generated on Tue Jan 15 17:13:05 2019 by
705
+ Generated on Mon Jun 17 18:38:43 2019 by
706
706
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
707
- 0.9.16 (ruby-2.5.3).
707
+ 0.9.19 (ruby-2.5.3).
708
708
  </div>
709
709
 
710
710
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Mocha::ParameterMatchers
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -3039,9 +3039,9 @@ duck.

3039
3039
  </div>
3040
3040
 
3041
3041
  <div id="footer">
3042
- Generated on Tue Jan 15 17:13:06 2019 by
3042
+ Generated on Mon Jun 17 18:38:43 2019 by
3043
3043
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
3044
- 0.9.16 (ruby-2.5.3).
3044
+ 0.9.19 (ruby-2.5.3).
3045
3045
  </div>
3046
3046
 
3047
3047
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: Mocha::ParameterMatchers::AllOf
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -144,9 +144,9 @@ AND.

144
144
  </div>
145
145
 
146
146
  <div id="footer">
147
- Generated on Tue Jan 15 17:13:06 2019 by
147
+ Generated on Mon Jun 17 18:38:44 2019 by
148
148
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
149
- 0.9.16 (ruby-2.5.3).
149
+ 0.9.19 (ruby-2.5.3).
150
150
  </div>
151
151
 
152
152
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: Mocha::ParameterMatchers::AnyOf
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.9.0
10
10
 
11
11
  </title>
12
12
 
@@ -144,9 +144,9 @@ OR.

144
144
  </div>
145
145
 
146
146
  <div id="footer">
147
- Generated on Tue Jan 15 17:13:06 2019 by
147
+ Generated on Mon Jun 17 18:38:44 2019 by
148
148
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
149
- 0.9.16 (ruby-2.5.3).
149
+ 0.9.19 (ruby-2.5.3).
150
150
  </div>
151
151
 
152
152
  </div>