summaryrefslogtreecommitdiff
path: root/spec/models/user_spec.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-08-21 11:29:31 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-08-21 11:29:31 +0200
commit3091a76724a6452bb70dc324dd1a7e4359c0af5d (patch)
tree7448eae5b9c1642fc4464094f88c845e1604f7ad /spec/models/user_spec.rb
parentb755753c0c7c5ea3e803e4479ae14ef373d75067 (diff)
downloadgitlab-ce-3091a76724a6452bb70dc324dd1a7e4359c0af5d.tar.gz
Fix SQL error when sorting 2FA-enabled users by name in admin area
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r--spec/models/user_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 9763477a711..fd99acb3bb2 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -315,6 +315,14 @@ describe User do
expect(users_with_two_factor).to eq([user_with_2fa.id])
expect(users_with_two_factor).not_to include(user_without_2fa.id)
end
+
+ it 'works with ORDER BY' do
+ user_with_2fa = create(:user, :two_factor_via_otp, :two_factor_via_u2f)
+
+ expect(described_class
+ .with_two_factor
+ .reorder_by_name).to eq([user_with_2fa])
+ end
end
describe ".without_two_factor" do