RSpec Shared Contexts Explained

Опубликовано: 11 Март 2026
на канале: Brett Codes
387
6

A nice tool in your RSpec toolbox to have is shared contexts. They let you share common set up and functions across specs with the ability to easily override the default values they pull in.

In this screenshot I go through an example of how to use them and talk through some common use cases.

View the source from this episode: https://github.com/brettchalupa/scree...

Ruby 3.1.1
RSpec 3.10.0

RSpec docs on shared contexts: https://relishapp.com/rspec/rspec-cor...