# Shared Contexts With RSpec

In the past, I used traits with my factories. Below is a simple example of defining a trait:

### Using traits

An example spec:

However, I believe that using a shared context is a clearer approach. Defining the amount in a shared context and overriding the amount allows more control over testing use cases.

### Using a shared context

I especially like the shared context approach because you can have shared context and redefine attributes as needed in specs.