diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/models/concerns/case_sensitivity_spec.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) | |
download | gitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/models/concerns/case_sensitivity_spec.rb')
-rw-r--r-- | spec/models/concerns/case_sensitivity_spec.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/models/concerns/case_sensitivity_spec.rb b/spec/models/concerns/case_sensitivity_spec.rb index 5fb7cdb4443..7cf7b825d7d 100644 --- a/spec/models/concerns/case_sensitivity_spec.rb +++ b/spec/models/concerns/case_sensitivity_spec.rb @@ -4,16 +4,16 @@ require 'spec_helper' RSpec.describe CaseSensitivity do describe '.iwhere' do - let(:connection) { ActiveRecord::Base.connection } - let(:model) do + let_it_be(:connection) { ActiveRecord::Base.connection } + let_it_be(:model) do Class.new(ActiveRecord::Base) do include CaseSensitivity self.table_name = 'namespaces' end end - let!(:model_1) { model.create!(path: 'mOdEl-1', name: 'mOdEl 1') } - let!(:model_2) { model.create!(path: 'mOdEl-2', name: 'mOdEl 2') } + let_it_be(:model_1) { model.create!(path: 'mOdEl-1', name: 'mOdEl 1') } + let_it_be(:model_2) { model.create!(path: 'mOdEl-2', name: 'mOdEl 2') } it 'finds a single instance by a single attribute regardless of case' do expect(model.iwhere(path: 'MODEL-1')).to contain_exactly(model_1) @@ -28,6 +28,10 @@ RSpec.describe CaseSensitivity do .to contain_exactly(model_1) end + it 'finds instances by custom Arel attributes' do + expect(model.iwhere(model.arel_table[:path] => 'MODEL-1')).to contain_exactly(model_1) + end + it 'builds a query using LOWER' do query = model.iwhere(path: %w(MODEL-1 model-2), name: 'model 1').to_sql expected_query = <<~QRY.strip |