minitest 4.7.0 → 4.7.1

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.
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,13 @@
1
+ === 4.7.1 / 2013-04-09
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Added FAQ section to README
6
+
7
+ * 1 bug fix:
8
+
9
+ * Fixed bug where guard runs tests bypassing minitest/autorun and an ivar isn't set right. (darrencauthon)
10
+
1
11
  === 4.7.0 / 2013-03-18
2
12
 
3
13
  * 1 major enhancement:
data/README.txt CHANGED
@@ -281,6 +281,54 @@ fixture loading:
281
281
 
282
282
  MiniTest::Unit.runner = MiniTestWithTransactions::Unit.new
283
283
 
284
+ == FAQ
285
+
286
+ === How to test SimpleDelegates?
287
+
288
+ The following implementation and test:
289
+
290
+ class Worker < SimpleDelegator
291
+ def work
292
+ end
293
+ end
294
+
295
+ describe Worker do
296
+ before do
297
+ @worker = Worker.new(Object.new)
298
+ end
299
+
300
+ it "must respond to work" do
301
+ @worker.must_respond_to :work
302
+ end
303
+ end
304
+
305
+ outputs a failure:
306
+
307
+ 1) Failure:
308
+ Worker#test_0001_must respond to work [bug11.rb:16]:
309
+ Expected #<Object:0x007f9e7184f0a0> (Object) to respond to #work.
310
+
311
+ Worker is a SimpleDelegate which in 1.9+ is a subclass of BasicObject.
312
+ Expectations are put on Object (one level down) so the Worker
313
+ (SimpleDelegate) hits `method_missing` and delegates down to the
314
+ `Object.new` instance. That object doesn't respond to work so the test
315
+ fails.
316
+
317
+ You can bypass `SimpleDelegate#method_missing` by extending the worker
318
+ with `MiniTest::Expectations`. You can either do that in your setup at
319
+ the instance level, like:
320
+
321
+ before do
322
+ @worker = Worker.new(Object.new)
323
+ @worker.extend MiniTest::Expectations
324
+ end
325
+
326
+ or you can extend the Worker class (within the test file!), like:
327
+
328
+ class Worker
329
+ include ::MiniTest::Expectations
330
+ end
331
+
284
332
  == Known Extensions:
285
333
 
286
334
  capybara_minitest_spec :: Bridge between Capybara RSpec matchers and MiniTest::Spec expectations (e.g. page.must_have_content('Title')).
@@ -726,10 +726,11 @@ module MiniTest
726
726
  end
727
727
 
728
728
  class Unit # :nodoc:
729
- VERSION = "4.7.0" # :nodoc:
729
+ VERSION = "4.7.1" # :nodoc:
730
730
 
731
731
  attr_accessor :report, :failures, :errors, :skips # :nodoc:
732
- attr_accessor :test_count, :assertion_count # :nodoc:
732
+ attr_accessor :assertion_count # :nodoc:
733
+ attr_writer :test_count # :nodoc:
733
734
  attr_accessor :start_time # :nodoc:
734
735
  attr_accessor :help # :nodoc:
735
736
  attr_accessor :verbose # :nodoc:
@@ -836,6 +837,10 @@ module MiniTest
836
837
  output.print(*a)
837
838
  end
838
839
 
840
+ def test_count # :nodoc:
841
+ @test_count ||= 0
842
+ end
843
+
839
844
  ##
840
845
  # Runner for a given +type+ (eg, test vs bench).
841
846
 
@@ -1051,7 +1056,7 @@ module MiniTest
1051
1056
  break unless report.empty?
1052
1057
  end
1053
1058
 
1054
- return failures + errors if @test_count > 0 # or return nil...
1059
+ return failures + errors if self.test_count > 0 # or return nil...
1055
1060
  rescue Interrupt
1056
1061
  abort 'Interrupted'
1057
1062
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest
3
3
  version: !ruby/object:Gem::Version
4
- hash: 35
4
+ hash: 33
5
5
  prerelease:
6
6
  segments:
7
7
  - 4
8
8
  - 7
9
- - 0
10
- version: 4.7.0
9
+ - 1
10
+ version: 4.7.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Davis
@@ -36,7 +36,7 @@ cert_chain:
36
36
  FBHgymkyj/AOSqKRIpXPhjC6
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2013-03-18 00:00:00 Z
39
+ date: 2013-04-10 00:00:00 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rdoc
@@ -46,11 +46,11 @@ dependencies:
46
46
  requirements:
47
47
  - - ~>
48
48
  - !ruby/object:Gem::Version
49
- hash: 19
49
+ hash: 27
50
50
  segments:
51
- - 3
52
- - 10
53
- version: "3.10"
51
+ - 4
52
+ - 0
53
+ version: "4.0"
54
54
  type: :development
55
55
  version_requirements: *id001
56
56
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file