diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-08-01 10:04:29 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-08-01 10:04:29 +0300 |
commit | 9b433c370688ddb4be261915da6aeb8327429966 (patch) | |
tree | 033c5f431affde7ead660f93efbf4612690a474a /spec/models | |
parent | b690c268c2c34e1a7e34a9bbef264fe986e2f2d4 (diff) | |
parent | ac05ebc330375a9624f6f42f053db96116f3e8ba (diff) |
Merge branch 'dz-labels-search' into 'master'
Search for label on project labels page by title or description
See merge request gitlab-org/gitlab-ce!20749
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/label_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/label_spec.rb b/spec/models/label_spec.rb index 8914845ea82..99670af786a 100644 --- a/spec/models/label_spec.rb +++ b/spec/models/label_spec.rb @@ -139,4 +139,20 @@ describe Label do end end end + + describe '.search' do + let(:label) { create(:label, title: 'bug', description: 'incorrect behavior') } + + it 'returns labels with a partially matching title' do + expect(described_class.search(label.title[0..2])).to eq([label]) + end + + it 'returns labels with a partially matching description' do + expect(described_class.search(label.description[0..5])).to eq([label]) + end + + it 'returns nothing' do + expect(described_class.search('feature')).to be_empty + end + end end |