summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/query_limiting/active_support_subscriber_spec.rb
blob: b49bc5c328ccdd671c0057a0f859b2ecd1548c9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require 'spec_helper'

describe Gitlab::QueryLimiting::ActiveSupportSubscriber do
  describe '#sql' do
    it 'increments the number of executed SQL queries' do
      transaction = double(:transaction)

      allow(Gitlab::QueryLimiting::Transaction)
        .to receive(:current)
        .and_return(transaction)

      expect(transaction)
        .to receive(:increment)
        .at_least(:once)

      User.count
    end
  end
end