Linux heracles.o2switch.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
/
opt
/
alt
/
ruby21
/
share
/
ri
/
2.1.0
/
system
/
MiniTest
/
//opt/alt/ruby21/share/ri/2.1.0/system/MiniTest/cdesc-MiniTest.ri
U:RDoc::NormalModule[iI" MiniTest:EF@0o:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[I"8Minimal (mostly drop-in) replacement for test-unit.;To:RDoc::Markup::BlankLine S:RDoc::Markup::Heading: leveli: textI"(minitest/{unit,spec,mock,benchmark};T@o:RDoc::Markup::List: @type: NOTE:@items[o:RDoc::Markup::ListItem:@label[I" home ;T;[o; ;[I"*https://github.com/seattlerb/minitest;To;;[I" rdoc ;T;[o; ;[I"'http://docs.seattlerb.org/minitest;To;;[I" vim ;T;[o; ;[I"0https://github.com/sunaku/vim-ruby-minitest;T@S;;i; I"DESCRIPTION:;T@o; ;[I"Iminitest provides a complete suite of testing facilities supporting ;TI")TDD, BDD, mocking, and benchmarking.;T@o:RDoc::Markup::Verbatim;[I"F"I had a class with Jim Weirich on testing last week and we were ;TI"G allowed to choose our testing frameworks. Kirk Haines and I were ;TI"< paired up and we cracked open the code for a few test ;TI" frameworks... ;TI" ;TI"C I MUST say that minitest is *very* readable / understandable ;TI"H compared to the 'other two' options we looked at. Nicely done and ;TI"8 thank you for helping us keep our mental sanity." ;TI" ;TI"-- Wayne E. Seguin ;T:@format0o; ;[I"Jminitest/unit is a small and incredibly fast unit testing framework. ;TI"GIt provides a rich set of assertions to make your tests clean and ;TI"readable.;T@o; ;[I"Iminitest/spec is a functionally complete spec engine. It hooks onto ;TI"Gminitest/unit and seamlessly bridges test assertions over to spec ;TI"expectations.;T@o; ;[ I"Lminitest/benchmark is an awesome way to assert the performance of your ;TI"Jalgorithms in a repeatable manner. Now you can assert that your newb ;TI"Ico-worker doesn't replace your linear algorithm with an exponential ;TI" one!;T@o; ;[I"Jminitest/mock by Steven Baker, is a beautifully tiny mock (and stub) ;TI"object framework.;T@o; ;[I"Jminitest/pride shows pride in testing and adds coloring to your test ;TI"Foutput. I guess it is an example of how to write IO pipes too. :P;T@o; ;[ I"Hminitest/unit is meant to have a clean implementation for language ;TI"Limplementors that need a minimal set of methods to bootstrap a working ;TI"Gtest suite. For example, there is no magic involved for test-case ;TI"discovery.;T@o;;[ I"A"Again, I can't praise enough the idea of a testing/specing ;TI"B framework that I can actually read in full in one sitting!" ;TI" ;TI"-- Piotr Szotkowski ;T;0o; ;[I"Comparing to rspec:;T@o;;[I"/rspec is a testing DSL. minitest is ruby. ;TI" ;TI",-- Adam Hawkins, "Bow Before MiniTest" ;T;0o; ;[ I"Jminitest doesn't reinvent anything that ruby already provides, like: ;TI"Iclasses, modules, inheritance, methods. This means you only have to ;TI"Jlearn ruby to use minitest and all of your regular OO practices like ;TI"-extract-method refactorings still apply.;T@S;;i; I"FEATURES/PROBLEMS:;T@o;;:BULLET;[o;;0;[o; ;[I"Hminitest/autorun - the easy and explicit way to run all your tests.;To;;0;[o; ;[I"@minitest/unit - a very fast, simple, and clean test system.;To;;0;[o; ;[I"@minitest/spec - a very fast, simple, and clean spec system.;To;;0;[o; ;[I"9minitest/mock - a simple and clean mock/stub system.;To;;0;[o; ;[I"Pminitest/benchmark - an awesome way to assert your algorithm's performance.;To;;0;[o; ;[I"1minitest/pride - show your pride in testing!;To;;0;[o; ;[I"AIncredibly small and fast runner, but no bells and whistles.;T@S;;i; I"RATIONALE:;T@o; ;[I"ISee design_rationale.rb to see how specs and tests work in minitest.;T@S;;i; I"SYNOPSIS:;T@o; ;[I"7Given that you'd like to test the following class:;T@o;;[I"class Meme ;TI"" def i_can_has_cheezburger? ;TI" "OHAI!" ;TI" end ;TI" ;TI" def will_it_blend? ;TI" "YES!" ;TI" end ;TI" end ;T;0S;;i; I"Unit tests;T@o;;[I" require 'minitest/autorun' ;TI" ;TI"/class TestMeme < MiniTest::Unit::TestCase ;TI" def setup ;TI" @meme = Meme.new ;TI" end ;TI" ;TI"# def test_that_kitty_can_eat ;TI"< assert_equal "OHAI!", @meme.i_can_has_cheezburger? ;TI" end ;TI" ;TI"' def test_that_it_will_not_blend ;TI"3 refute_match /^no/i, @meme.will_it_blend? ;TI" end ;TI" ;TI"% def test_that_will_be_skipped ;TI" skip "test this later" ;TI" end ;TI" end ;T;0S;;i; I" Specs;T@o;;[I" require 'minitest/autorun' ;TI" ;TI"describe Meme do ;TI" before do ;TI" @meme = Meme.new ;TI" end ;TI" ;TI"4 describe "when asked about cheeseburgers" do ;TI") it "must respond positively" do ;TI"; @meme.i_can_has_cheezburger?.must_equal "OHAI!" ;TI" end ;TI" end ;TI" ;TI"= describe "when asked about blending possibilities" do ;TI" it "won't say no" do ;TI"2 @meme.will_it_blend?.wont_match /^no/i ;TI" end ;TI" end ;TI" end ;T;0o; ;[I"$For matchers support check out:;T@o; ;[I"3https://github.com/zenspider/minitest-matchers;T@S;;i; I"Benchmarks;T@o; ;[I"LAdd benchmarks to your regular unit tests. If the unit tests fail, the ;TI"benchmarks won't run.;T@o;;[I"9# optionally run benchmarks, good for CI-only work! ;TI"2require 'minitest/benchmark' if ENV["BENCH"] ;TI" ;TI"/class TestMeme < MiniTest::Unit::TestCase ;TI"S # Override self.bench_range or default range is [1, 10, 100, 1_000, 10_000] ;TI" def bench_my_algorithm ;TI"F assert_performance_linear 0.9999 do |n| # n is a range value ;TI" @obj.my_algorithm(n) ;TI" end ;TI" end ;TI" end ;T;0o; ;[I"HOr add them to your specs. If you make benchmarks optional, you'll ;TI"Kneed to wrap your benchmarks in a conditional since the methods won't ;TI"be defined.;T@o;;[I"describe Meme do ;TI" if ENV["BENCH"] then ;TI"@ bench_performance_linear "my_algorithm", 0.9999 do |n| ;TI" 100.times do ;TI"" @obj.my_algorithm(n) ;TI" end ;TI" end ;TI" end ;TI" end ;T;0o; ;[I"outputs something like:;T@o;;[ I"# Running benchmarks: ;TI" ;TI"'TestBlah 100 1000 10000 ;TI"Cbench_my_algorithm 0.006167 0.079279 0.786993 ;TI"Kbench_other_algorithm 0.061679 0.792797 7.869932 ;T;0o; ;[I"IOutput is tab-delimited to make it easy to paste into a spreadsheet.;T@S;;i; I" Mocks;T@o;;["I"class MemeAsker ;TI" def initialize(meme) ;TI" @meme = meme ;TI" end ;TI" ;TI" def ask(question) ;TI"- method = question.tr(" ","_") + "?" ;TI" @meme.__send__(method) ;TI" end ;TI" end ;TI" ;TI" require 'minitest/autorun' ;TI" ;TI"describe MemeAsker do ;TI" before do ;TI"$ @meme = MiniTest::Mock.new ;TI"+ @meme_asker = MemeAsker.new @meme ;TI" end ;TI" ;TI" describe "#ask" do ;TI"< describe "when passed an unpunctuated question" do ;TI"N it "should invoke the appropriate predicate method on the meme" do ;TI"9 @meme.expect :will_it_blend?, :return_value ;TI"- @meme_asker.ask "will it blend" ;TI" @meme.verify ;TI" end ;TI" end ;TI" end ;TI" end ;T;0S;;i; I" Stubs;T@o;;[I"def test_stale_eh ;TI"& obj_under_test = Something.new ;TI" ;TI"$ refute obj_under_test.stale? ;TI" ;TI"O Time.stub :now, Time.at(0) do # stub goes away once the block is done ;TI"& assert obj_under_test.stale? ;TI" end ;TI" end ;T;0o; ;[I"DA note on stubbing: In order to stub a method, the method must ;TI"Jactually exist prior to stubbing. Use a singleton method to create a ;TI"new non-existing method:;T@o;;[I"$def obj_under_test.fake_method ;TI" ... ;TI" end ;T;0S;;i; I"$Customizable Test Runner Types:;T@o; ;[ I"LMiniTest::Unit.runner=(runner) provides an easy way of creating custom ;TI"Ctest runners for specialized needs. Justin Weiss provides the ;TI"Ffollowing real-world example to create an alternative to regular ;TI"fixture loading:;T@o;;[1I"4class MiniTestWithHooks::Unit < MiniTest::Unit ;TI" def before_suites ;TI" end ;TI" ;TI" def after_suites ;TI" end ;TI" ;TI"% def _run_suites(suites, type) ;TI" begin ;TI" before_suites ;TI" super(suites, type) ;TI" ensure ;TI" after_suites ;TI" end ;TI" end ;TI" ;TI"# def _run_suite(suite, type) ;TI" begin ;TI" suite.before_suite ;TI" super(suite, type) ;TI" ensure ;TI" suite.after_suite ;TI" end ;TI" end ;TI" end ;TI" ;TI"%module MiniTestWithTransactions ;TI", class Unit < MiniTestWithHooks::Unit ;TI"! include TestSetupHelper ;TI" ;TI" def before_suites ;TI" super ;TI"% setup_nested_transactions ;TI"; # load any data we want available for all tests ;TI" end ;TI" ;TI" def after_suites ;TI"( teardown_nested_transactions ;TI" super ;TI" end ;TI" end ;TI" end ;TI" ;TI"@MiniTest::Unit.runner = MiniTestWithTransactions::Unit.new ;T;0S;;i; I"FAQ;T@S;;i; I"!How to test SimpleDelegates?;T@o; ;[I"+The following implementation and test:;T@o;;[I"$class Worker < SimpleDelegator ;TI" def work ;TI" end ;TI" end ;TI" ;TI"describe Worker do ;TI" before do ;TI"* @worker = Worker.new(Object.new) ;TI" end ;TI" ;TI"$ it "must respond to work" do ;TI"' @worker.must_respond_to :work ;TI" end ;TI" end ;T;0o; ;[I"outputs a failure:;T@o;;[I" 1) Failure: ;TI":Worker#test_0001_must respond to work [bug11.rb:16]: ;TI"GExpected #<Object:0x007f9e7184f0a0> (Object) to respond to #work. ;T;0o; ;[ I"LWorker is a SimpleDelegate which in 1.9+ is a subclass of BasicObject. ;TI"CExpectations are put on Object (one level down) so the Worker ;TI"F(SimpleDelegate) hits `method_missing` and delegates down to the ;TI"L`Object.new` instance. That object doesn't respond to work so the test ;TI"fails.;T@o; ;[I"LYou can bypass `SimpleDelegate#method_missing` by extending the worker ;TI"Lwith `MiniTest::Expectations`. You can either do that in your setup at ;TI"the instance level, like:;T@o;;[ I"before do ;TI"( @worker = Worker.new(Object.new) ;TI"- @worker.extend MiniTest::Expectations ;TI" end ;T;0o; ;[I"For you can extend the Worker class (within the test file!), like:;T@o;;[I"class Worker ;TI"( include ::MiniTest::Expectations ;TI" end ;T;0S;;i; I"Known Extensions:;T@o;;;;[2o;;[I"!capybara_minitest_spec ;T;[o; ;[I"sBridge between Capybara RSpec matchers and MiniTest::Spec expectations (e.g. page.must_have_content('Title')).;To;;[I"!minispec-metadata ;T;[o; ;[I"%Metadata for describe/it blocks ;TI"2(e.g. `it 'requires JS driver', js: true do`);To;;[I"!minitest-ansi ;T;[o; ;[I"/Colorize minitest output with ANSI colors.;To;;[I"!minitest-around ;T;[o; ;[I"GAround block for minitest. An alternative to setup/teardown dance.;To;;[I"!minitest-capistrano ;T;[o; ;[I"?Assertions and expectations for testing Capistrano recipes;To;;[I"!minitest-capybara ;T;[o; ;[I"9Capybara matchers support for minitest unit and spec;To;;[I"!minitest-chef-handler ;T;[o; ;[I"0Run Minitest suites as Chef report handlers;To;;[I"!minitest-ci ;T;[o; ;[I"%CI reporter plugin for MiniTest.;To;;[I"!minitest-colorize ;T;[o; ;[I"?Colorize MiniTest output and show failing tests instantly.;To;;[I"!minitest-context ;T;[o; ;[I"1Defines contexts for code reuse in MiniTest ;TI"*specs that share common expectations.;To;;[I"!minitest-debugger ;T;[o; ;[I"1Wraps assert so failed assertions drop into ;TI"the ruby debugger.;To;;[I"!minitest-display ;T;[o; ;[I"APatches MiniTest to allow for an easily configurable output.;To;;[I"!minitest-emoji ;T;[o; ;[I"<Print out emoji for your test passes, fails, and skips.;To;;[I"!minitest-english ;T;[o; ;[I"DSemantically symmetric aliases for assertions and expectations.;To;;[I"!minitest-excludes ;T;[o; ;[I"/Clean API for excluding certain tests you ;TI"0don't want to run under certain conditions.;To;;[I"!minitest-firemock ;T;[o; ;[I".Makes your MiniTest mocks more resilient.;To;;[I"!minitest-great_expectations ;T;[o; ;[I"IGenerally useful additions to minitest's assertions and expectations;To;;[I"!minitest-growl ;T;[o; ;[I"*Test notifier for minitest via growl.;To;;[I"!minitest-implicit-subject ;T;[o; ;[I".Implicit declaration of the test subject.;To;;[I"!minitest-instrument ;T;[o; ;[I"2Instrument ActiveSupport::Notifications when ;TI"test method is executed;To;;[I"!minitest-instrument-db ;T;[o; ;[I"+Store information about speed of test ;TI":execution provided by minitest-instrument in database;To;;[I"!minitest-libnotify ;T;[o; ;[I".Test notifier for minitest via libnotify.;To;;[I"!minitest-macruby ;T;[o; ;[I"<Provides extensions to minitest for macruby UI testing.;To;;[I"!minitest-matchers ;T;[o; ;[I"7Adds support for RSpec-style matchers to minitest.;To;;[I"!minitest-metadata ;T;[o; ;[I".Annotate tests with metadata (key-value).;To;;[I"!minitest-mongoid ;T;[o; ;[I",Mongoid assertion matchers for MiniTest;To;;[I"!minitest-must_not ;T;[o; ;[I"7Provides must_not as an alias for wont in MiniTest;To;;[I"!minitest-nc ;T;[o; ;[I"GTest notifier for minitest via Mountain Lion's Notification Center;To;;[I"!minitest-predicates ;T;[o; ;[I")Adds support for .predicate? methods;To;;[I"!minitest-rails ;T;[o; ;[I"'MiniTest integration for Rails 3.x;To;;[I"!minitest-rails-capybara ;T;[o; ;[I"-Capybara integration for MiniTest::Rails;To;;[I"!minitest-reporters ;T;[o; ;[I"0Create customizable MiniTest output formats;To;;[I"!minitest-should_syntax ;T;[o; ;[I"8RSpec-style +x.should == y+ assertions for MiniTest;To;;[I"!minitest-shouldify ;T;[o; ;[I"8Adding all manner of shoulds to MiniTest (bad idea);To;;[I"!minitest-spec-context ;T;[o; ;[I"8Provides rspec-ish context method to MiniTest::Spec;To;;[I"!minitest-spec-magic ;T;[o; ;[I"3Minitest::Spec extensions for Rails and beyond;To;;[I"!minitest-spec-rails ;T;[o; ;[I"CDrop in MiniTest::Spec superclass for ActiveSupport::TestCase.;To;;[I"!minitest-stub-const ;T;[o; ;[I"/Stub constants for the duration of a block;To;;[I"!minitest-tags ;T;[o; ;[I"add tags for minitest;To;;[I"!minitest-wscolor ;T;[o; ;[I" Yet another test colorizer.;To;;[I"!minitest_owrapper ;T;[o; ;[I".Get tests results as a TestResult object.;To;;[I"!minitest_should ;T;[o; ;[I"2Shoulda style syntax for minitest test::unit.;To;;[I"!minitest_tu_shim ;T;[o; ;[I"=minitest_tu_shim bridges between test/unit and minitest.;To;;[I"!mongoid-minitest ;T;[o; ;[I"#MiniTest matchers for Mongoid.;To;;[I"!pry-rescue ;T;[o; ;[I"BA pry plugin w/ minitest support. See pry-rescue/minitest.rb.;T@S;;i; I"Unknown Extensions:;T@o; ;[I"\Authors... Please send me a pull request with a description of your minitest extension.;T@o;;;;[o;;0;[o; ;[I"assay-minitest;To;;0;[o; ;[I"detroit-minitest;To;;0;[o; ;[I"em-minitest-spec;To;;0;[o; ;[I"flexmock-minitest;To;;0;[o; ;[I"guard-minitest;To;;0;[o; ;[I"guard-minitest-decisiv;To;;0;[o; ;[I"minitest-activemodel;To;;0;[o; ;[I"minitest-ar-assertions;To;;0;[o; ;[I"minitest-capybara-unit;To;;0;[o; ;[I"minitest-colorer;To;;0;[o; ;[I"minitest-deluxe;To;;0;[o; ;[I"minitest-extra-assertions;To;;0;[o; ;[I"minitest-rails-shoulda;To;;0;[o; ;[I"minitest-spec;To;;0;[o; ;[I"minitest-spec-should;To;;0;[o; ;[I"minitest-sugar;To;;0;[o; ;[I"minitest_should;To;;0;[o; ;[I"mongoid-minitest;To;;0;[o; ;[I"spork-minitest;T@S;;i; I"REQUIREMENTS:;T@o;;;;[o;;0;[o; ;[I"=Ruby 1.8, maybe even 1.6 or lower. No magic is involved.;T@S;;i; I" INSTALL:;T@o;;[I"sudo gem install minitest ;T;0o; ;[I"KOn 1.9, you already have it. To get newer candy you can still install ;TI"Gthe gem, but you'll need to activate the gem explicitly to use it:;T@o;;[ I"require 'rubygems' ;TI"Lgem 'minitest' # ensures you're using the gem, and not the built in MT ;TI" require 'minitest/autorun' ;TI" ;TI"$# ... usual testing stuffs ... ;T;0o; ;[ I"HDO NOTE: There is a serious problem with the way that ruby 1.9/2.0 ;TI"Ipackages their own gems. They install a gem specification file, but ;TI"Ddon't install the gem contents in the gem path. This messes up ;TI"IGem.find_files and many other things (gem which, gem contents, etc).;T@o; ;[I"CJust install minitest as a gem for real and you'll be happier.;T@S;;i; I" LICENSE:;T@o; ;[I"(The MIT License);T@o; ;[I")Copyright (c) Ryan Davis, seattle.rb;T@o; ;[I"KPermission is hereby granted, free of charge, to any person obtaining ;TI"Ea copy of this software and associated documentation files (the ;TI"I'Software'), to deal in the Software without restriction, including ;TI"Iwithout limitation the rights to use, copy, modify, merge, publish, ;TI"Hdistribute, sublicense, and/or sell copies of the Software, and to ;TI"Kpermit persons to whom the Software is furnished to do so, subject to ;TI"the following conditions:;T@o; ;[I"DThe above copyright notice and this permission notice shall be ;TI"Dincluded in all copies or substantial portions of the Software.;T@o; ;[I"ETHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, ;TI"HEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ;TI"LMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ;TI"JIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ;TI"JCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ;TI"GTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ;TI";SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.;T: @fileI"lib/minitest/unit.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[[ I"backtrace_filter;TI"RW;T:publicTI"lib/minitest/unit.rb;T[ [ [[I" class;T[[;[ [:protected[ [:private[ [I" instance;T[[;[ [;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ;0;0[I"lib/minitest/autorun.rb;TI"lib/minitest/benchmark.rb;TI"lib/minitest/mock.rb;TI""lib/minitest/parallel_each.rb;TI"lib/minitest/pride.rb;TI"lib/minitest/spec.rb;T@�I"lib/test/unit.rb;TI" lib/test/unit/assertions.rb;TI"lib/test/unit/parallel.rb;T@�cRDoc::TopLevel