v0.4.0
This release includes basic ground required to actually start use this library for any test suite.
Features:
expect().to ...
syntax by default with option to enableshould
onObject
.- no global scope pollution with
Spec2.describe
+ option to enable globaldescribe
DSL. describe
,context
,it
DSL for defining examples and example groups.before
andafter
hooks to be executed before and after each example in current and nested example groups.let
,let!
,subject
andsubject!
for defining example-group-scoped bindings.- minimal necessary list of builtin matchers (matches stdlib's
spec
list). - random order execution.
- color and no-color output.
- minimal and documentation reporters.
- ability to configure almost every piece of library by using custom runner, order, reporter and/or output.
- ability to register your own matchers.
List of implemented builtin matchers:
eq("hello, world")
- asserts actual is equal to expectedraise_error(ErrorClass [, message_matcher])
- checks if block raises expected errorbe(42)
- asserts actual is the same as expectedmatch(/hello .+/)
- asserts actual is matching provided regexpbe_true
- asserts actual is equal truebe_false
- asserts actual is equal falsebe_truthy
- asserts actual is not nil or falsebe_falsey
- asserts actual is nil or falsebe_nil
- asserts actual is equal nilbe_close(42, 0.01)
- asserts actual is in delta-proximity of expectedexpect(42).to_be < 45
- asserts arbitrary method call on actual to be truthybe_a(String)
- asserts actual to be of expected type (uses is_a?)