minitest 5.8.0 → 5.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cadf6da908e8558c23ccb2b48f04440c58548170
4
- data.tar.gz: 3da4643eb6db1d74cdac7ba8aaa47f74865ae5fb
3
+ metadata.gz: afba7b74c4a3b74b76007242b439f17720f039c6
4
+ data.tar.gz: 517dac13240555cb8e0688f40b7077d56756e8e4
5
5
  SHA512:
6
- metadata.gz: 8c522d5cd91d724391203d28a4e18310113c368d42da3e3a068733414db307b8368a1fd4a28567bc9da19d6c374b7dffee98efe37deb53273f390f7c911c8d4f
7
- data.tar.gz: 4935850af98ba3ea0c2a784333d1c831c4feea72c5b88a903006d1feeba87aebabf02c47b81869d1cbf4eade1dcfda95216b2512509d1c61b2bfd739fad92039
6
+ metadata.gz: a660c1e4b7335d0db45770c906351070f317a00f4e6b76a1d1ce882efbbd0a8343f3854351a3d18540dcb33dd5c7a30470a1610828883262bcd7c36734bf6f4d
7
+ data.tar.gz: 4d406c3a9bf69bb7606f40df5231b31f79be461ea4e17fd01b8287ef37fd63e6bb4d6fc58592e2815793c20fc85030ec89ee6e40b44646f75e96cce0df2ad6b3
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,25 @@
1
+ === 5.8.3 / 2015-11-17
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Added extra note about mocks and threads to readme. (zamith)
6
+
7
+ * 1 bug fix:
8
+
9
+ * Fixed bug in Mock#verify. (pithub/zamith)
10
+
11
+ === 5.8.2 / 2015-10-26
12
+
13
+ * 1 bug fix:
14
+
15
+ * Fixed using parallelize_me! and capture_io (or any locking io). (arlt/tenderlove)
16
+
17
+ === 5.8.1 / 2015-09-23
18
+
19
+ * 1 minor enhancement:
20
+
21
+ * Refactor assert_raises to be cleaner and to pass SystemExit and SignalException. (bhenderson)
22
+
1
23
  === 5.8.0 / 2015-08-06
2
24
 
3
25
  * 2 minor enhancements:
data/README.rdoc CHANGED
@@ -219,6 +219,20 @@ verification to ensure they got all the calls they were expecting."
219
219
  end
220
220
  end
221
221
 
222
+ **Multi-threading and Mocks**
223
+
224
+ Minitest mocks do not support multi-threading if it works, fine, if it doesn't
225
+ you can use regular ruby patterns and facilities like local variables. Here's
226
+ an example of asserting that code inside a thread is run:
227
+
228
+ def test_called_inside_thread
229
+ called = false
230
+ pr = Proc.new { called = true }
231
+ thread = Thread.new(&pr)
232
+ thread.join
233
+ assert called, "proc not called"
234
+ end
235
+
222
236
  === Stubs
223
237
 
224
238
  Mocks and stubs are defined using terminology by Fowler & Meszaros at
@@ -455,6 +469,7 @@ minitest-bacon :: minitest-bacon extends minitest with bacon-like
455
469
  minitest-bang :: Adds support for RSpec-style let! to immediately
456
470
  invoke let statements before each test.
457
471
  minitest-bisect :: Helps you isolate and debug random test failures.
472
+ minitest-blink1_reporter :: Display test results with a Blink1.
458
473
  minitest-capistrano :: Assertions and expectations for testing
459
474
  Capistrano recipes.
460
475
  minitest-capybara :: Capybara matchers support for minitest unit and
@@ -298,17 +298,18 @@ module Minitest
298
298
 
299
299
  begin
300
300
  yield
301
- rescue Minitest::Skip => e
302
- return e if exp.include? Minitest::Skip
303
- raise e
301
+ rescue *exp => e
302
+ pass # count assertion
303
+ return e
304
+ rescue Minitest::Skip
305
+ # don't count assertion
306
+ raise
307
+ rescue SignalException, SystemExit
308
+ raise
304
309
  rescue Exception => e
305
- expected = exp.any? { |ex| e.kind_of? ex }
306
-
307
- assert expected, proc {
310
+ flunk proc {
308
311
  exception_details(e, "#{msg}#{mu_pp(exp)} exception expected, not")
309
312
  }
310
-
311
- return e
312
313
  end
313
314
 
314
315
  exp = exp.first if exp.size == 1
data/lib/minitest/mock.rb CHANGED
@@ -65,8 +65,7 @@ module Minitest # :nodoc:
65
65
  # @mock.verify # => true
66
66
  #
67
67
  # @mock.expect(:uses_one_string, true, ["foo"])
68
- # @mock.uses_one_string("bar") # => true
69
- # @mock.verify # => raises MockExpectationError
68
+ # @mock.uses_one_string("bar") # => raises MockExpectationError
70
69
 
71
70
  def expect(name, retval, args = [], &blk)
72
71
  name = name.to_sym
@@ -96,16 +95,11 @@ module Minitest # :nodoc:
96
95
  # expected.
97
96
 
98
97
  def verify
99
- @expected_calls.each do |name, calls|
100
- calls.each do |expected|
101
- raise MockExpectationError, "expected #{__call name, expected}, got [#{__call name, @actual_calls[name]}]" if
102
- @actual_calls.key?(name) and
103
- not @actual_calls[name].include?(expected)
104
-
105
- raise MockExpectationError, "expected #{__call name, expected}" unless
106
- @actual_calls.key?(name) and
107
- @actual_calls[name].include?(expected)
108
- end
98
+ @expected_calls.each do |name, expected|
99
+ actual = @actual_calls.fetch(name, nil)
100
+ raise MockExpectationError, "expected #{__call name, expected[0]}" unless actual
101
+ raise MockExpectationError, "expected #{__call name, expected[actual.size]}, got [#{__call name, actual}]" if
102
+ actual.size < expected.size
109
103
  end
110
104
  true
111
105
  end
@@ -53,7 +53,7 @@ module Minitest
53
53
  end
54
54
 
55
55
  module Test
56
- def _synchronize; Test.io_lock.synchronize { yield }; end # :nodoc:
56
+ def _synchronize; Minitest::Test.io_lock.synchronize { yield }; end # :nodoc:
57
57
 
58
58
  module ClassMethods # :nodoc:
59
59
  def run_one_method klass, method_name, reporter
data/lib/minitest.rb CHANGED
@@ -7,7 +7,7 @@ require "minitest/parallel"
7
7
  # :include: README.rdoc
8
8
 
9
9
  module Minitest
10
- VERSION = "5.8.0" # :nodoc:
10
+ VERSION = "5.8.3" # :nodoc:
11
11
  ENCS = "".respond_to? :encoding # :nodoc:
12
12
 
13
13
  @@installed_at_exit ||= false
@@ -240,6 +240,20 @@ class TestMinitestMock < Minitest::Test
240
240
  assert_equal exp, e.message
241
241
  end
242
242
 
243
+ def test_same_method_expects_with_same_args_blow_up_when_not_all_called
244
+ mock = Minitest::Mock.new
245
+ mock.expect :foo, nil, [:bar]
246
+ mock.expect :foo, nil, [:bar]
247
+
248
+ mock.foo :bar
249
+
250
+ e = assert_raises(MockExpectationError) { mock.verify }
251
+
252
+ exp = "expected foo(:bar) => nil, got [foo(:bar) => nil]"
253
+
254
+ assert_equal exp, e.message
255
+ end
256
+
243
257
  def test_verify_passes_when_mock_block_returns_true
244
258
  mock = Minitest::Mock.new
245
259
  mock.expect :foo, nil do
@@ -1293,6 +1293,18 @@ class TestMinitestUnitTestCase < Minitest::Test
1293
1293
  assert_equal expected.chomp, actual
1294
1294
  end
1295
1295
 
1296
+ def test_assert_raises_exit
1297
+ @tc.assert_raises SystemExit do
1298
+ exit 1
1299
+ end
1300
+ end
1301
+
1302
+ def test_assert_raises_signals
1303
+ @tc.assert_raises SignalException do
1304
+ raise SignalException, :INT
1305
+ end
1306
+ end
1307
+
1296
1308
  def test_assert_respond_to
1297
1309
  @tc.assert_respond_to "blah", :empty?
1298
1310
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.8.0
4
+ version: 5.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -10,9 +10,9 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBAjANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBAzANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTE0MDkxNzIzMDcwN1oXDTE1MDkxNzIzMDcwN1owRTETMBEGA1UE
15
+ GRYDY29tMB4XDTE1MDkxOTIwNTEyMloXDTE2MDkxODIwNTEyMlowRT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fpIehiusVAPHkNf7qbpHq
29
+ qx3h45R1CAsObX0SQDIT+rRbQrtKz1GHIZTOFYvEJjUY1XmRTZupD3CJ8Q7sDqSy
30
+ NLq5jm1fq6Y9Uolu3RJbmycf
31
31
  -----END CERTIFICATE-----
32
- date: 2015-08-06 00:00:00.000000000 Z
32
+ date: 2015-11-17 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rdoc
@@ -51,14 +51,14 @@ dependencies:
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '3.13'
54
+ version: '3.14'
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '3.13'
61
+ version: '3.14'
62
62
  description: |-
63
63
  minitest provides a complete suite of testing facilities supporting
64
64
  TDD, BDD, mocking, and benchmarking.
@@ -123,7 +123,6 @@ extra_rdoc_files:
123
123
  - README.rdoc
124
124
  files:
125
125
  - .autotest
126
- - .gemtest
127
126
  - History.rdoc
128
127
  - Manifest.txt
129
128
  - README.rdoc
metadata.gz.sig CHANGED
Binary file
data/.gemtest DELETED
File without changes