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:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-08-01 10:04:29 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-08-01 10:04:29 +0300
commit9b433c370688ddb4be261915da6aeb8327429966 (patch)
tree033c5f431affde7ead660f93efbf4612690a474a /spec/models
parentb690c268c2c34e1a7e34a9bbef264fe986e2f2d4 (diff)
parentac05ebc330375a9624f6f42f053db96116f3e8ba (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.rb16
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