summaryrefslogtreecommitdiff
path: root/spec/finders
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-15 06:06:13 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-15 06:06:13 +0000
commit3fe34368770022c88fd89c8df58b39bf0789e646 (patch)
tree0b8aa07f8b17e4565c491383b5b8b6cc728a1e4a /spec/finders
parent41d446ba3f0518097eb350b142ecfbeeb6be83e6 (diff)
downloadgitlab-ce-3fe34368770022c88fd89c8df58b39bf0789e646.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/projects_finder_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/finders/projects_finder_spec.rb b/spec/finders/projects_finder_spec.rb
index e97a94f6fa5..a9344cd593a 100644
--- a/spec/finders/projects_finder_spec.rb
+++ b/spec/finders/projects_finder_spec.rb
@@ -58,6 +58,31 @@ describe ProjectsFinder, :do_not_mock_admin_mode do
it { is_expected.to eq([internal_project]) }
end
+ describe 'with id_after' do
+ context 'only returns projects with a project id greater than given' do
+ let(:params) { { id_after: internal_project.id }}
+
+ it { is_expected.to eq([public_project]) }
+ end
+ end
+
+ describe 'with id_before' do
+ context 'only returns projects with a project id less than given' do
+ let(:params) { { id_before: public_project.id }}
+
+ it { is_expected.to eq([internal_project]) }
+ end
+ end
+
+ describe 'with both id_before and id_after' do
+ context 'only returns projects with a project id less than given' do
+ let!(:projects) { create_list(:project, 5, :public) }
+ let(:params) { { id_after: projects.first.id, id_before: projects.last.id }}
+
+ it { is_expected.to contain_exactly(*projects[1..-2]) }
+ end
+ end
+
describe 'filter by visibility_level' do
before do
private_project.add_maintainer(user)