diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-18 06:10:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-18 06:10:30 +0300 |
commit | 14facaa466ed56cd0dfad8c0f821ea32f94f94a0 (patch) | |
tree | 16f08c5a5d8e1241871a5c4f7398a0e2f0aab445 /spec/models | |
parent | 90e7f31698f6d67da00ed3a68a7392127746ced2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/concerns/routable_spec.rb | 6 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/concerns/routable_spec.rb b/spec/models/concerns/routable_spec.rb index cf66ba83e87..dc1002f3560 100644 --- a/spec/models/concerns/routable_spec.rb +++ b/spec/models/concerns/routable_spec.rb @@ -23,6 +23,12 @@ RSpec.shared_examples 'routable resource' do end.not_to exceed_all_query_limit(control_count) end + context 'when path is a negative number' do + it 'returns nil' do + expect(described_class.find_by_full_path(-1)).to be_nil + end + end + context 'with redirect routes' do let_it_be(:redirect_route) { create(:redirect_route, source: record) } diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index b08c85339d1..e6d4e9cc2f6 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1166,6 +1166,20 @@ RSpec.describe User do 'ORDER BY "users"."last_activity_on" ASC NULLS FIRST, "users"."id" DESC') end end + + describe '.order_recent_sign_in' do + it 'sorts users by current_sign_in_at in descending order' do + expect(described_class.order_recent_sign_in.to_sql).to include( + 'ORDER BY "users"."current_sign_in_at" DESC NULLS LAST') + end + end + + describe '.order_oldest_sign_in' do + it 'sorts users by current_sign_in_at in ascending order' do + expect(described_class.order_oldest_sign_in.to_sql).to include( + 'ORDER BY "users"."current_sign_in_at" ASC NULLS LAST') + end + end end context 'strip attributes' do |