Welcome to mirror list, hosted at ThFree Co, Russian Federation.

transactions_spec.rb « concerns « models « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 404a33196e6ab5bed1b2b6d6c51b7967cddb94c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Transactions do
  let(:model) { build(:project) }

  it 'is not in a transaction' do
    expect(model.class).not_to be_inside_transaction
  end

  it 'is in a transaction', :aggregate_failures do
    Project.transaction do
      expect(model.class).to be_inside_transaction
    end

    ApplicationRecord.transaction do
      expect(model.class).to be_inside_transaction
    end
  end
end