diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-27 21:08:47 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-27 21:08:47 +0000 |
commit | e4ea43b2b85ad5f3115f00220601eb719705139a (patch) | |
tree | 1888a43f802e45ebb8dfed59595a790807777c6f /spec/models | |
parent | 390582e118752426acf5cb25ec99103d312d891c (diff) | |
download | gitlab-ce-e4ea43b2b85ad5f3115f00220601eb719705139a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/project_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 51320b2c9f9..0bb19609e27 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -3780,6 +3780,25 @@ describe Project do end end + describe '.wrap_authorized_projects_with_cte' do + let!(:user) { create(:user) } + + let!(:private_project) do + create(:project, :private, creator: user, namespace: user.namespace) + end + + let!(:public_project) { create(:project, :public) } + + let(:projects) { described_class.all.public_or_visible_to_user(user) } + + subject { described_class.wrap_authorized_projects_with_cte(projects) } + + it 'wrapped query matches original' do + expect(subject.to_sql).to match(/^WITH "authorized_projects" AS/) + expect(subject).to match_array(projects) + end + end + describe '#pages_available?' do let(:project) { create(:project, group: group) } |