diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/lib/gitlab/tree_summary_spec.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/lib/gitlab/tree_summary_spec.rb')
-rw-r--r-- | spec/lib/gitlab/tree_summary_spec.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/lib/gitlab/tree_summary_spec.rb b/spec/lib/gitlab/tree_summary_spec.rb index d64b826ba9b..593b8655e80 100644 --- a/spec/lib/gitlab/tree_summary_spec.rb +++ b/spec/lib/gitlab/tree_summary_spec.rb @@ -8,12 +8,13 @@ describe Gitlab::TreeSummary do let(:project) { create(:project, :empty_repo) } let(:repo) { project.repository } let(:commit) { repo.head_commit } + let_it_be(:user) { create(:user) } let(:path) { nil } let(:offset) { nil } let(:limit) { nil } - subject(:summary) { described_class.new(commit, project, path: path, offset: offset, limit: limit) } + subject(:summary) { described_class.new(commit, project, user, path: path, offset: offset, limit: limit) } describe '#initialize' do it 'defaults offset to 0' do @@ -72,7 +73,8 @@ describe Gitlab::TreeSummary do expected_commit_path = Gitlab::Routing.url_helpers.project_commit_path(project, commit) expect(entry[:commit]).to be_a(::Commit) - expect(entry[:commit_path]).to eq expected_commit_path + expect(entry[:commit_path]).to eq(expected_commit_path) + expect(entry[:commit_title_html]).to eq(commit.message) end context 'in a good subdirectory' do @@ -140,6 +142,16 @@ describe Gitlab::TreeSummary do expect(entry).to include(:commit) end end + + context 'rendering commits' do + it 'does not perform N + 1 request' do + summary + + queries = ActiveRecord::QueryRecorder.new { summary.summarize } + + expect(queries.count).to be <= 3 + end + end end describe '#more?' do |