Specs can’t exist on their own. From the first spec you wrote while reading this book, every spec has been part of an example group. The example group fulfills the role of a test case class in other test frameworks. It has multiple purposes:
Gives a logical structure for understanding how individual examples relate to one another
Describes the context—such as a particular class, method, or situation—of what you’re testing
Provides a Ruby class to act as a scope for your shared logic, such as hooks, let definitions, and helper methods
Runs common setup and teardown code shared by several examples
Let’s look at a few different ways to create these groups.
We saw the basic ways to organize specs in Groups, Examples, ...