Repository navigation
Home
Cyril Kato edited this page Nov 1, 2026
·
2 revisions
Examples for RSpec clone, each one a spec file you can run, with what it writes. The README is the reference: what the clone does, its matchers, its differences from RSpec. The pages here show it at work.
Each example is a file, spec/NAME_spec.rb, shown whole, so the line numbers of the report are those of the code block. The outputs were written by Ruby 4.0: Ruby 3.3 writes a Hash as {:foo=>1} and a backtrace with backticks.
-
Expectation example:
expect,toandnot_to, with a value or a block. -
Let example: helpers, parameters,
super, and the absence of memoization. -
Subject and its example:
subject,is_expected,itswith arguments. - Before block example: hooks, nested and several in one group.
- Context example: what a child process keeps for itself.
- Pending example: examples written for later.
-
Expecting errors example:
raise_exceptionwith a class, a message, a pattern. -
Change example: the five forms of
change. -
Custom matcher example: any object with
match?andto_s, Fix specifications included. - Reading the report: the four outcomes, the frames of an error, the exit status.
- Project setup: a spec helper, a Rakefile, running one file or all of them.
- Cheat sheet: every word and every matcher on one page.
- Coming from RSpec: what to write instead of what RSpec has.