Hack hack hack...

An open journal-- some of it written for you, but most of it is for me.

MiniTest::Spec

MiniTest Spec Matchers
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
obj.must_be(operator, expected) - for example, 10.must_be :< , 11
obj.must_be_close_to - the equivalent of assert_in_delta
obj.must_be_empty - Fails unless obj.empty?
obj.must_be_instance_of(klass) - Fails unless obj.class == klass
obj.must_be_kind_of(klass) - Fails unless obj is of class klass or klass is one of its superclasses.
obj.must_be_nil
obj.must_be_same_as - tests for true object equality
lambda {}.must_be_silent
obj.must_be_within_delta
obj.must_be_within_epsilon
obj.must_equal(other) - Does a ==/eql? comparison between two objects.
obj.must_include(other)
obj.must_match(regex) - A regular expression match, e.g. "hello".must_match /w+/
lambda {}.must_output(stdout, [stderr..]) - The block should have certain output on stdout or stderr. Set stdout to nil just to check stderr.
lambda {}.must_raise(exception)
obj.must_respond_to(message)
obj.must_throw(sym)
Negative Matchers too
1
2
3
4
5
6
7
8
9
10
wont_be
wont_be_empty
wont_be_instance_of
wont_be_kind_of
wont_be_nil
wont_be_same_as
wont_equal
wont_include
wont_match
wont_respond_to

Comments