Skip to content

v0.4.0

Compare
Choose a tag to compare
@waterlink waterlink released this 18 Oct 20:41
· 69 commits to master since this release

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 enable should on Object.
  • no global scope pollution with Spec2.describe + option to enable global describe DSL.
  • describe, context, it DSL for defining examples and example groups.
  • before and after hooks to be executed before and after each example in current and nested example groups.
  • let, let!, subject and subject! 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 expected
  • raise_error(ErrorClass [, message_matcher]) - checks if block raises expected error
  • be(42) - asserts actual is the same as expected
  • match(/hello .+/) - asserts actual is matching provided regexp
  • be_true - asserts actual is equal true
  • be_false - asserts actual is equal false
  • be_truthy - asserts actual is not nil or false
  • be_falsey - asserts actual is nil or false
  • be_nil - asserts actual is equal nil
  • be_close(42, 0.01) - asserts actual is in delta-proximity of expected
  • expect(42).to_be < 45 - asserts arbitrary method call on actual to be truthy
  • be_a(String) - asserts actual to be of expected type (uses is_a?)