title: How do I tell database_cleaner to not run in the middle of a particular group of rspec tests
body: <p>I have a set of ordered tests that mimick user actions and depend one on another.</p>
  
  <p>How do I configure <code>database_cleaner</code> to not clean the database in the middle of these ordered tests?</p>
  
  <pre><code>/spec/support/database_cleaner.rb:
  
  RSpec.configure do |config|
    config.before(:suite) do
      DatabaseCleaner.clean_with(:truncation)
    end
  
    config.before(:each) do
      DatabaseCleaner.strategy = :transaction
    end
  
    config.before(:each, js: true) do
      DatabaseCleaner.strategy = :truncation
    end
  
    config.before(:each) do
      DatabaseCleaner.start
    end
  
    config.after(:each) do
      DatabaseCleaner.clean
    end
  end
  </code></pre>
  
  <p>Sample of tests:</p>
  
  <pre><code>RSpec.describe Conversation, type: :model, order: :defined do
    context 'by default' do
      before :context do
        @alice = create :user
        @bob = create :user
        @subject = 'subject'
        @body = 'body'
        @conversation = @alice.send_message(@bob, @subject, @body)
      end
  
      it 'should have the subject it was opened with' do
        expect(@conversation.subject).to eq @subject
      end
  
      it 'should have one message upon opening' do
        expect(@conversation.messages.count).to eq 1
      end
  
      it 'should be initiated by @alice' do
        expect(@conversation.initiator).to eq @alice
      end
  
      it 'should be received by @bob' do
        expect(@conversation.recipient).to eq @bob
      end
  
      it 'should have two messages when bob sends a new message' do
        @conversation.add_message(@bob, 'This is my second message')
        expect(@conversation.messages.count).to eq 2
      end
  end
  </code></pre>