diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /spec/finders/releases_finder_spec.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/finders/releases_finder_spec.rb')
-rw-r--r-- | spec/finders/releases_finder_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/finders/releases_finder_spec.rb b/spec/finders/releases_finder_spec.rb index e8049a9eb81..94b6fe53daa 100644 --- a/spec/finders/releases_finder_spec.rb +++ b/spec/finders/releases_finder_spec.rb @@ -77,6 +77,34 @@ RSpec.describe ReleasesFinder do expect(subject).to eq([v1_1_0, v1_0_0]) end + context 'with sorting parameters' do + before do + v1_1_0.update_attribute(:created_at, 3.days.ago) + end + + context 'by default is released_at in descending order' do + it { is_expected.to eq([v1_1_0, v1_0_0]) } + end + + context 'released_at in ascending order' do + let(:params) { { sort: 'asc' } } + + it { is_expected.to eq([v1_0_0, v1_1_0]) } + end + + context 'order by created_at in descending order' do + let(:params) { { order_by: 'created_at' } } + + it { is_expected.to eq([v1_0_0, v1_1_0]) } + end + + context 'order by created_at in ascending order' do + let(:params) { { order_by: 'created_at', sort: 'asc' } } + + it { is_expected.to eq([v1_1_0, v1_0_0]) } + end + end + it_behaves_like 'preload' it_behaves_like 'when tag is nil' it_behaves_like 'when a tag parameter is passed' |