minitest 5.11.0 → 5.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 715f3317d00a75f840668207642ed04f6bba9891
4
- data.tar.gz: 5afd442e33b93f31916d28010a0b03deb00c055f
2
+ SHA256:
3
+ metadata.gz: f45ca8b284609e6c73accd4bd7d71144ecb79433ee5039246e2ed83abc87bafe
4
+ data.tar.gz: 0f67c6fbd863252ed2421d4c15b018a009d3f53a798c4c882d0135780fda239b
5
5
  SHA512:
6
- metadata.gz: ff4e51abc82b3a84a36c7077ecd4d317471832462a1f594cb1789a38a19e31f2f6db391e504e70926ce88b15ef7596433c3db5d3581fe7f2ccff19fe541a4ddb
7
- data.tar.gz: 92b42e9bfd3cdc22e338f80228259763f17896b7b4ec2b586e1c233c8ceded230bf2a0c168a16077c08a2cc6a98ae73c66aa065431949c38c2a0dae51448d89e
6
+ metadata.gz: d7d542986e130f4f3288453677aee162e749f94ee26bfec890822d2619908ee983e15990107659c8abfdbb8ec323a318c4d4da8e16d19fb44238db60ded410a7
7
+ data.tar.gz: 28ec3b0bf85fd91947a19bcfb02c7c09fdb1b2976f139f320c66fc74a04e8316dd1dbb1f75c47206bedb63ad5f0a77da048ef09ff0377c5aca533fd3164ddb14
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,57 @@
1
+ === 5.12.1 / 2019-09-28
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Added documentation for Reporter classes. (sshaw)
6
+
7
+ * 3 bug fixes:
8
+
9
+ * Avoid using 'match?' to support older ruby versions. (y-yagi)
10
+ * Fixed broken link to reference on goodness-of-fit testing. (havenwood)
11
+ * Update requirements in readme and Rakefile/hoe spec.
12
+
13
+ === 5.12.0 / 2019-09-22
14
+
15
+ * 8 minor enhancements:
16
+
17
+ * Added a descriptive error if assert_output or assert_raises called without a block. (okuramasafumi)
18
+ * Changed mu_pp_for_diff to make having both \n and \\n easier to debug.
19
+ * Deprecated $N for specifying number of parallel test runners. Use MT_CPU.
20
+ * Deprecated use of global expectations. To be removed from MT6.
21
+ * Extended Assertions#mu_pp to encoding validity output for strings to improve diffs.
22
+ * Extended Assertions#mu_pp to output encoding and validity if invalid to improve diffs.
23
+ * Extended Assertions#mu_pp_for_diff to make escaped newlines more obvious in diffs.
24
+ * Fail gracefully when expectation used outside of `it`.
25
+
26
+ * 3 bug fixes:
27
+
28
+ * Check `option[:filter]` klass before match. Fixes 2.6 warning. (y-yagi)
29
+ * Fixed Assertions#diff from recalculating if set to nil
30
+ * Fixed spec section of readme to not use deprecated global expectations. (CheezItMan)
31
+
32
+ === 5.11.3 / 2018-01-26
33
+
34
+ * 1 bug fix:
35
+
36
+ * Pushed #error? up to Reportable module. (composerinteralia)
37
+
38
+ === 5.11.2 / 2018-01-25
39
+
40
+ * 1 minor enhancement:
41
+
42
+ * Reversed Test < Result. Back to < Runnable and using Reportable for shared code.
43
+
44
+ * 2 bug fixes:
45
+
46
+ * Fixed Result#location for instances of Test. (alexisbernard)
47
+ * Fixed deprecation message for Runnable#marshal_dump. (y-yagi)
48
+
49
+ === 5.11.1 / 2018-01-02
50
+
51
+ * 1 bug fix:
52
+
53
+ * Fixed Result (a superclass of Test) overriding Runnable's name accessors. (y-yagi, MSP-Greg)
54
+
1
55
  === 5.11.0 / 2018-01-01
2
56
 
3
57
  * 2 major enhancements:
@@ -19,6 +19,7 @@ lib/minitest/spec.rb
19
19
  lib/minitest/test.rb
20
20
  lib/minitest/unit.rb
21
21
  test/minitest/metametameta.rb
22
+ test/minitest/test_minitest_assertions.rb
22
23
  test/minitest/test_minitest_benchmark.rb
23
24
  test/minitest/test_minitest_mock.rb
24
25
  test/minitest/test_minitest_reporter.rb
@@ -126,13 +126,13 @@ Define your tests as methods beginning with +test_+.
126
126
 
127
127
  describe "when asked about cheeseburgers" do
128
128
  it "must respond positively" do
129
- @meme.i_can_has_cheezburger?.must_equal "OHAI!"
129
+ _(@meme.i_can_has_cheezburger?).must_equal "OHAI!"
130
130
  end
131
131
  end
132
132
 
133
133
  describe "when asked about blending possibilities" do
134
134
  it "won't say no" do
135
- @meme.will_it_blend?.wont_match /^no/i
135
+ _(@meme.will_it_blend?).wont_match /^no/i
136
136
  end
137
137
  end
138
138
  end
@@ -220,9 +220,9 @@ verification to ensure they got all the calls they were expecting."
220
220
  end
221
221
  end
222
222
 
223
- **Multi-threading and Mocks**
223
+ ==== Multi-threading and Mocks
224
224
 
225
- Minitest mocks do not support multi-threading if it works, fine, if it doesn't
225
+ Minitest mocks do not support multi-threading. If it works, fine, if it doesn't
226
226
  you can use regular ruby patterns and facilities like local variables. Here's
227
227
  an example of asserting that code inside a thread is run:
228
228
 
@@ -294,6 +294,18 @@ provided via plugins. To see them, simply run with +--help+:
294
294
  -p, --pride Pride. Show your testing pride!
295
295
  -a, --autotest Connect to autotest server.
296
296
 
297
+ You can set up a rake task to run all your tests by adding this to your Rakefile:
298
+
299
+ require "rake/testtask"
300
+
301
+ Rake::TestTask.new(:test) do |t|
302
+ t.libs << "test"
303
+ t.libs << "lib"
304
+ t.test_files = FileList["test/**/test_*.rb"]
305
+ end
306
+
307
+ task :default => :test
308
+
297
309
  == Writing Extensions
298
310
 
299
311
  To define a plugin, add a file named minitest/XXX_plugin.rb to your
@@ -379,7 +391,7 @@ The following implementation and test:
379
391
  end
380
392
 
381
393
  it "must respond to work" do
382
- @worker.must_respond_to :work
394
+ _(@worker).must_respond_to :work
383
395
  end
384
396
  end
385
397
 
@@ -469,6 +481,8 @@ able to require minitest and run your tests.
469
481
 
470
482
  == Developing Minitest:
471
483
 
484
+ Minitest requires {Hoe}[https://rubygems.org/gems/hoe].
485
+
472
486
  === Minitest's own tests require UTF-8 external encoding.
473
487
 
474
488
  This is a common problem in Windows, where the default external Encoding is
@@ -547,6 +561,7 @@ minispec-metadata :: Metadata for describe/it blocks & CLI tag filter.
547
561
  E.g. <tt>it "requires JS driver", js: true do</tt> &
548
562
  <tt>ruby test.rb --tag js</tt> runs tests tagged :js.
549
563
  minispec-rails :: Minimal support to use Spec style in Rails 5+.
564
+ mini-apivore :: for swagger based automated API testing.
550
565
  minitest-around :: Around block for minitest. An alternative to
551
566
  setup/teardown dance.
552
567
  minitest-assert_errors :: Adds Minitest assertions to test for errors raised
@@ -589,6 +604,7 @@ minitest-firemock :: Makes your Minitest mocks more resilient.
589
604
  minitest-focus :: Focus on one test at a time.
590
605
  minitest-gcstats :: A minitest plugin that adds a report of the top
591
606
  tests by number of objects allocated.
607
+ minitest-global_expectations:: Support minitest expectation methods for all objects
592
608
  minitest-great_expectations :: Generally useful additions to minitest's
593
609
  assertions and expectations.
594
610
  minitest-growl :: Test notifier for minitest via growl.
@@ -615,6 +631,7 @@ minitest-matchers :: Adds support for RSpec-style matchers to
615
631
  minitest-matchers_vaccine :: Adds assertions that adhere to the matcher spec,
616
632
  but without any expectation infections.
617
633
  minitest-metadata :: Annotate tests with metadata (key-value).
634
+ minitest-mock_expectations :: Provides method call assertions for minitest.
618
635
  minitest-mongoid :: Mongoid assertion matchers for Minitest.
619
636
  minitest-must_not :: Provides must_not as an alias for wont in
620
637
  Minitest.
@@ -664,6 +681,7 @@ minitest_owrapper :: Get tests results as a TestResult object.
664
681
  minitest_should :: Shoulda style syntax for minitest test::unit.
665
682
  minitest_tu_shim :: Bridges between test/unit and minitest.
666
683
  mongoid-minitest :: Minitest matchers for Mongoid.
684
+ mutant-minitest :: Minitest integration for mutant.
667
685
  pry-rescue :: A pry plugin w/ minitest support. See
668
686
  pry-rescue/minitest.rb.
669
687
  rspec2minitest :: Easily translate any RSpec matchers to Minitest
@@ -697,8 +715,7 @@ Authors... Please send me a pull request with a description of your minitest ext
697
715
 
698
716
  == REQUIREMENTS:
699
717
 
700
- * Ruby 1.8.7+. No magic is involved. I hope.
701
- * NOTE: 1.8 and 1.9 will be dropped in minitest 6+.
718
+ * Ruby 2.3+. No magic is involved. I hope.
702
719
 
703
720
  == INSTALL:
704
721
 
data/Rakefile CHANGED
@@ -11,21 +11,7 @@ Hoe.spec "minitest" do
11
11
 
12
12
  license "MIT"
13
13
 
14
- ## TODO: uncomment this on the last point release on 5.x
15
- #
16
- # self.post_install_message = <<-"EOM"
17
- # NOTE: minitest 5 will be the last in the minitest family to support
18
- # ruby 1.8 and 1.9 (and maybe 2.0?). If you need to keep using 1.8
19
- # or 1.9, you need to pin your dependency to minitest with
20
- # something like "~> 5.0".
21
- #
22
- # Further, minitest 6 will be dropping the following:
23
- #
24
- # + MiniTest (it's been Minitest for *years*)
25
- # + MiniTest::Unit
26
- # + MiniTest::Unit::TestCase
27
- # + assert_send (unless you argue for it well)
28
- # EOM
14
+ require_ruby_version "~> 2.3"
29
15
  end
30
16
 
31
17
  desc "Find missing expectations"
@@ -8,7 +8,7 @@ require "stringio"
8
8
  # :include: README.rdoc
9
9
 
10
10
  module Minitest
11
- VERSION = "5.11.0" # :nodoc:
11
+ VERSION = "5.12.1" # :nodoc:
12
12
  ENCS = "".respond_to? :encoding # :nodoc:
13
13
 
14
14
  @@installed_at_exit ||= false
@@ -21,7 +21,10 @@ module Minitest
21
21
  # Parallel test executor
22
22
 
23
23
  mc.send :attr_accessor, :parallel_executor
24
- self.parallel_executor = Parallel::Executor.new((ENV["N"] || 2).to_i)
24
+
25
+ warn "DEPRECATED: use MT_CPU instead of N for parallel test runs" if ENV["N"]
26
+ n_threads = (ENV["MT_CPU"] || ENV["N"] || 2).to_i
27
+ self.parallel_executor = Parallel::Executor.new n_threads
25
28
 
26
29
  ##
27
30
  # Filter object for backtraces.
@@ -301,7 +304,7 @@ module Minitest
301
304
 
302
305
  def self.run reporter, options = {}
303
306
  filter = options[:filter] || "/./"
304
- filter = Regexp.new $1 if filter =~ %r%/(.*)/%
307
+ filter = Regexp.new $1 if filter.is_a?(String) && filter =~ %r%/(.*)/%
305
308
 
306
309
  filtered_methods = self.runnable_methods.find_all { |m|
307
310
  filter === m || filter === "#{self}##{m}"
@@ -381,7 +384,7 @@ module Minitest
381
384
 
382
385
  def marshal_dump # :nodoc:
383
386
  unless @@marshal_dump_warned then
384
- warn ["Minitest::Test#marshal_dump is deprecated.",
387
+ warn ["Minitest::Runnable#marshal_dump is deprecated.",
385
388
  "You might be violating internals. From", caller.first].join " "
386
389
  @@marshal_dump_warned = true
387
390
  end
@@ -422,7 +425,8 @@ module Minitest
422
425
 
423
426
  ##
424
427
  # Returns a single character string to print based on the result
425
- # of the run. Eg ".", "F", or "E".
428
+ # of the run. One of <tt>"."</tt>, <tt>"F"</tt>,
429
+ # <tt>"E"</tt> or <tt>"S"</tt>.
426
430
 
427
431
  def result_code
428
432
  raise NotImplementedError, "subclass responsibility"
@@ -436,6 +440,56 @@ module Minitest
436
440
  end
437
441
  end
438
442
 
443
+ ##
444
+ # Shared code for anything that can get passed to a Reporter. See
445
+ # Minitest::Test & Minitest::Result.
446
+
447
+ module Reportable
448
+ ##
449
+ # Did this run pass?
450
+ #
451
+ # Note: skipped runs are not considered passing, but they don't
452
+ # cause the process to exit non-zero.
453
+
454
+ def passed?
455
+ not self.failure
456
+ end
457
+
458
+ ##
459
+ # The location identifier of this test. Depends on a method
460
+ # existing called class_name.
461
+
462
+ def location
463
+ loc = " [#{self.failure.location}]" unless passed? or error?
464
+ "#{self.class_name}##{self.name}#{loc}"
465
+ end
466
+
467
+ def class_name # :nodoc:
468
+ raise NotImplementedError, "subclass responsibility"
469
+ end
470
+
471
+ ##
472
+ # Returns ".", "F", or "E" based on the result of the run.
473
+
474
+ def result_code
475
+ self.failure and self.failure.result_code or "."
476
+ end
477
+
478
+ ##
479
+ # Was this run skipped?
480
+
481
+ def skipped?
482
+ self.failure and Skip === self.failure
483
+ end
484
+
485
+ ##
486
+ # Did this run error?
487
+
488
+ def error?
489
+ self.failures.any? { |f| UnexpectedError === f }
490
+ end
491
+ end
492
+
439
493
  ##
440
494
  # This represents a test result in a clean way that can be
441
495
  # marshalled over a wire. Tests can do anything they want to the
@@ -444,6 +498,8 @@ module Minitest
444
498
  # that the test result can be marshalled.
445
499
 
446
500
  class Result < Runnable
501
+ include Minitest::Reportable
502
+
447
503
  undef_method :marshal_dump
448
504
  undef_method :marshal_load
449
505
 
@@ -452,11 +508,6 @@ module Minitest
452
508
 
453
509
  attr_accessor :klass
454
510
 
455
- ##
456
- # The test name of the test result.
457
-
458
- attr_accessor :name
459
-
460
511
  ##
461
512
  # The location of the test method.
462
513
 
@@ -479,43 +530,8 @@ module Minitest
479
530
  r
480
531
  end
481
532
 
482
- ##
483
- # Did this run error?
484
-
485
- def error?
486
- self.failures.any? { |f| UnexpectedError === f }
487
- end
488
-
489
- ##
490
- # The location identifier of this test.
491
-
492
- def location
493
- loc = " [#{self.failure.location}]" unless passed? or error?
494
- "#{self.klass}##{self.name}#{loc}"
495
- end
496
-
497
- ##
498
- # Did this run pass?
499
- #
500
- # Note: skipped runs are not considered passing, but they don't
501
- # cause the process to exit non-zero.
502
-
503
- def passed?
504
- not self.failure
505
- end
506
-
507
- ##
508
- # Returns ".", "F", or "E" based on the result of the run.
509
-
510
- def result_code
511
- self.failure and self.failure.result_code or "."
512
- end
513
-
514
- ##
515
- # Was this run skipped?
516
-
517
- def skipped?
518
- self.failure and Skip === self.failure
533
+ def class_name # :nodoc:
534
+ self.klass # for Minitest::Reportable
519
535
  end
520
536
 
521
537
  def to_s # :nodoc:
@@ -548,8 +564,10 @@ module Minitest
548
564
  end
549
565
 
550
566
  ##
551
- # Record a result and output the Runnable#result_code. Stores the
552
- # result of the run if the run did not pass.
567
+ # Output and record the result of the test. Call
568
+ # {result#result_code}[rdoc-ref:Runnable#result_code] to get the
569
+ # result character string. Stores the result of the run if the run
570
+ # did not pass.
553
571
 
554
572
  def record result
555
573
  end
@@ -616,18 +634,63 @@ module Minitest
616
634
  #
617
635
  # If you want to create an entirely different type of output (eg,
618
636
  # CI, HTML, etc), this is the place to start.
637
+ #
638
+ # Example:
639
+ #
640
+ # class JenkinsCIReporter < StatisticsReporter
641
+ # def report
642
+ # super # Needed to calculate some statistics
643
+ #
644
+ # print "<testsuite "
645
+ # print "tests='#{count}' "
646
+ # print "failures='#{failures}' "
647
+ # # Remaining XML...
648
+ # end
649
+ # end
619
650
 
620
651
  class StatisticsReporter < Reporter
621
- # :stopdoc:
652
+ ##
653
+ # Total number of assertions.
654
+
622
655
  attr_accessor :assertions
656
+
657
+ ##
658
+ # Total number of test cases.
659
+
623
660
  attr_accessor :count
661
+
662
+ ##
663
+ # An +Array+ of test cases that failed or were skipped.
664
+
624
665
  attr_accessor :results
666
+
667
+ ##
668
+ # Time the test run started. If available, the monotonic clock is
669
+ # used and this is a +Float+, otherwise it's an instance of
670
+ # +Time+.
671
+
625
672
  attr_accessor :start_time
673
+
674
+ ##
675
+ # Test run time. If available, the monotonic clock is used and
676
+ # this is a +Float+, otherwise it's an instance of +Time+.
677
+
626
678
  attr_accessor :total_time
679
+
680
+ ##
681
+ # Total number of tests that failed.
682
+
627
683
  attr_accessor :failures
684
+
685
+ ##
686
+ # Total number of tests that erred.
687
+
628
688
  attr_accessor :errors
689
+
690
+ ##
691
+ # Total number of tests that where skipped.
692
+
629
693
  attr_accessor :skips
630
- # :startdoc:
631
694
 
632
695
  def initialize io = $stdout, options = {} # :nodoc:
633
696
  super
@@ -657,7 +720,10 @@ module Minitest
657
720
  results << result if not result.passed? or result.skipped?
658
721
  end
659
722
 
660
- def report # :nodoc:
723
+ ##
724
+ # Report on the tracked statistics.
725
+
726
+ def report
661
727
  aggregate = results.group_by { |r| r.failure.class }
662
728
  aggregate.default = [] # dumb. group_by should provide this
663
729