There are two ways to do this:
- Set up transaction examples for each individual test.
- Set up transactional examples for all tests.
If you select option 1: at the top of the specification file, after:
require 'spec_helper'
Add
RSpec.configure {|c| c.use_transactional_examples = true }
This will result in transaction rollback after each example.
2. If you want to configure it globally, then in spec_helper.rb
RSpec.configure do |config| ... config.use_transactional_examples = true
source share