diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-02-23 13:47:43 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-02-23 13:47:43 +0000 |
commit | bb0fe96f75c6a39e57ac5e9f1895a85f8453e3a5 (patch) | |
tree | fe269a7d864843602b7fe88cfad8650dd4e0b4a8 /spec | |
parent | 58a312f5097b30a93100de93d06427402d514b48 (diff) | |
parent | 090eeb581b3809ab83d52f7baa2bcfbd63b1c2ba (diff) | |
download | gitlab-ce-bb0fe96f75c6a39e57ac5e9f1895a85f8453e3a5.tar.gz |
Merge branch 'users-autocomplete' into 'master'
Improve performance of searching for and auto completing of users
See merge request gitlab-org/gitlab-ce!17158
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/autocomplete_controller_spec.rb | 10 | ||||
-rw-r--r-- | spec/lib/gitlab/sql/pattern_spec.rb | 6 |
2 files changed, 12 insertions, 4 deletions
diff --git a/spec/controllers/autocomplete_controller_spec.rb b/spec/controllers/autocomplete_controller_spec.rb index 73fff6eb5ca..b7257fac608 100644 --- a/spec/controllers/autocomplete_controller_spec.rb +++ b/spec/controllers/autocomplete_controller_spec.rb @@ -109,15 +109,17 @@ describe AutocompleteController do end context 'limited users per page' do - let(:per_page) { 2 } - before do + 25.times do + create(:user) + end + sign_in(user) - get(:users, per_page: per_page) + get(:users) end it { expect(json_response).to be_kind_of(Array) } - it { expect(json_response.size).to eq(per_page) } + it { expect(json_response.size).to eq(20) } end context 'unauthenticated user' do diff --git a/spec/lib/gitlab/sql/pattern_spec.rb b/spec/lib/gitlab/sql/pattern_spec.rb index ef51e3cc8df..5b5052de372 100644 --- a/spec/lib/gitlab/sql/pattern_spec.rb +++ b/spec/lib/gitlab/sql/pattern_spec.rb @@ -154,6 +154,12 @@ describe Gitlab::SQL::Pattern do it 'returns a single equality condition' do expect(fuzzy_arel_match.to_sql).to match(/title.*I?LIKE 'fo'/) end + + it 'uses LOWER instead of ILIKE when LOWER is enabled' do + rel = Issue.fuzzy_arel_match(:title, query, lower_exact_match: true) + + expect(rel.to_sql).to match(/LOWER\(.*title.*\).*=.*'fo'/) + end end context 'with two words both equal to 3 chars' do |