diff options
Diffstat (limited to 'spec/finders')
-rw-r--r-- | spec/finders/projects_finder_spec.rb | 25 |
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) |