thewanderingcoder.com - Sean Miller: The Wandering Coder

Example domain paragraphs

RSpec has a described_class method, which, given a spec starting

RSpec.describe Accounting::Ledger::Entry do lets us use described_class for Accounting::Ledger::Entry within the spec, which is less noisy (particularly with long class names) and very handy if we later rename the class.

RSpec also has a subject method which exposes not the class but an instance of the class. It can be over-ridden implicitly, by putting a different class name in an inner describe block’s description:

Links to thewanderingcoder.com (1)