Sha256: cfc6c3caa94ce7cd59317ff11424dc14f09ca706fbb4e0d7ec0ffec527cbaace
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
require 'test/test_helper' class TestNanoTest < MiniTest::Unit::TestCase def teardown NanoTest::FAILURES.clear end test "api" do class Foo; include NanoTest end assert_respond_to Foo.new, :assert assert_respond_to NanoTest, :assert end test "assertion passes" do out, err = capture_io do NanoTest.assert { true } end assert_equal '.', out assert_empty NanoTest::FAILURES end test "assertion fails (false)" do out, err = capture_io do NanoTest.assert { false } end assert_equal 'F', out refute_empty NanoTest::FAILURES end test "assertion fails (nil)" do out, err = capture_io do NanoTest.assert { nil } end assert_equal 'F', out refute_empty NanoTest::FAILURES end test "failure message" do capture_io do @line = __LINE__; NanoTest.assert { false } end assert_equal 1, NanoTest::FAILURES.size assert_includes NanoTest::FAILURES, "(%s:%0.3d) assertion failed" % [__FILE__, @line] end test "custom failure message, file, line" do capture_io do NanoTest.assert('foo','bar',2) { false } end assert_includes NanoTest::FAILURES, "(bar:002) foo" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nanotest-0.9.2 | test/test_nanotest.rb |