diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/lib/gitlab/application_context_spec.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) | |
download | gitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/lib/gitlab/application_context_spec.rb')
-rw-r--r-- | spec/lib/gitlab/application_context_spec.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/lib/gitlab/application_context_spec.rb b/spec/lib/gitlab/application_context_spec.rb index 6674ea059a0..3be967ac8a4 100644 --- a/spec/lib/gitlab/application_context_spec.rb +++ b/spec/lib/gitlab/application_context_spec.rb @@ -55,10 +55,10 @@ describe Gitlab::ApplicationContext do end describe '#to_lazy_hash' do - let(:user) { build(:user) } - let(:project) { build(:project) } - let(:namespace) { create(:group) } - let(:subgroup) { create(:group, parent: namespace) } + let_it_be(:user) { create(:user) } + let_it_be(:project) { create(:project) } + let_it_be(:namespace) { create(:group) } + let_it_be(:subgroup) { create(:group, parent: namespace) } def result(context) context.to_lazy_hash.transform_values { |v| v.respond_to?(:call) ? v.call : v } @@ -106,5 +106,11 @@ describe Gitlab::ApplicationContext do context.use {} end + + it 'does not cause queries' do + context = described_class.new(project: create(:project), namespace: create(:group, :nested), user: create(:user)) + + expect { context.use { Labkit::Context.current.to_h } }.not_to exceed_query_limit(0) + end end end |