summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/graphql/loaders/batch_project_statistics_loader_spec.rb
blob: ec2fcad31e5a5aa3b6948d8b3034638d3790778b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

require 'spec_helper'

describe Gitlab::Graphql::Loaders::BatchProjectStatisticsLoader do
  describe '#find' do
    it 'only queries once for project statistics' do
      stats = create_list(:project_statistics, 2)
      project1 = stats.first.project
      project2 = stats.last.project

      expect do
        described_class.new(project1.id).find
        described_class.new(project2.id).find
      end.not_to exceed_query_limit(1)
    end
  end
end