diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /spec/support/shared_examples/lib/gitlab/search_results_sorted_shared_examples.rb | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'spec/support/shared_examples/lib/gitlab/search_results_sorted_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/lib/gitlab/search_results_sorted_shared_examples.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/support/shared_examples/lib/gitlab/search_results_sorted_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/search_results_sorted_shared_examples.rb index eafb49cef71..e4f09dfa0b0 100644 --- a/spec/support/shared_examples/lib/gitlab/search_results_sorted_shared_examples.rb +++ b/spec/support/shared_examples/lib/gitlab/search_results_sorted_shared_examples.rb @@ -33,3 +33,21 @@ RSpec.shared_examples 'search results sorted' do end end end + +RSpec.shared_examples 'search results sorted by popularity' do + context 'sort: popularity_desc' do + let(:sort) { 'popularity_desc' } + + it 'sorts results by upvotes' do + expect(results_popular.objects(scope).map(&:id)).to eq([popular_result.id, less_popular_result.id, non_popular_result.id]) + end + end + + context 'sort: popularity_asc' do + let(:sort) { 'popularity_asc' } + + it 'sorts results by created_at' do + expect(results_popular.objects(scope).map(&:id)).to eq([non_popular_result.id, less_popular_result.id, popular_result.id]) + end + end +end |