Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/application_record_spec.rb')
-rw-r--r--spec/models/application_record_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/application_record_spec.rb b/spec/models/application_record_spec.rb
index 9c9a048999c..c1cd44e9007 100644
--- a/spec/models/application_record_spec.rb
+++ b/spec/models/application_record_spec.rb
@@ -104,6 +104,18 @@ RSpec.describe ApplicationRecord do
end
end
+ describe '.where_not_exists' do
+ it 'produces a WHERE NOT EXISTS query' do
+ create(:user, :two_factor_via_u2f)
+ user_2 = create(:user)
+
+ expect(
+ User.where_not_exists(
+ U2fRegistration.where(U2fRegistration.arel_table[:user_id].eq(User.arel_table[:id])))
+ ).to match_array([user_2])
+ end
+ end
+
describe '.transaction', :delete do
it 'opens a new transaction' do
expect(described_class.connection.transaction_open?).to be false