Minitest + all the features you always wanted.
MIT License
Minitest + all the features you always wanted.
before :all
blocksaround { |t| Dir.chdir(...) { t.call } }
mtest
executable to run by line number and by folder (disabled/integrated on rails 5)-v
)let!
let_all
execute once for all tests in a class and it's subclassesorder_dependent!
to make your tests run in given orderMaxitest.static_class_order = true
no longer sort tests class/sub-classes in random ordercontext
for more expressionpending { assert false }
is skip when it fails, but fails when it passesrequire 'maxitest/implicit_subject'
xit
to skip test (also does not call setup or teardown)with_env
to change environment variables during test runcapture_stdout
and capture_stderr
to capture stdout or stderr but not both (like capture_io
does)require 'maxitest/timeout'
to make hanging tests fail after Maxitest.timeout
secondsrequire 'maxitest/threads'
fail tests that leave extra threads runningrequire 'maxitest/global_must'
(before autorun) disable deprecation on global must_*
or global_expectations gemgem install maxitest
require "maxitest/autorun"
# ... normal minitest tests ...
describe MyClass do
describe "#my_method" do
it "passes" do
_(MyClass.new.my_method).must_equal 1
end
end
end
pending "need to fix" do
to show why something is pendingpending "need to fix", if: ENV["CI"] do
to only skip on CI (if something is supposed to work locally)Use during test: with_env FOO: "bar do ...
Use as around
block: with_env FOO: "bar"
Use as alias for describe
describe "#my_method" do
context "with bad state" do
before { errors += 1 }
it "fails" # ...
end
end
output = capture_stdout { puts 1 }
_(output).must_equal "1\n"
rake bundle
to update all vendored gemsMichael Grosser [email protected] License: MIT