summaryrefslogtreecommitdiff
path: root/spec/models/group_spec.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-03-01 16:15:42 +0100
committerRobert Speicher <rspeicher@gmail.com>2016-03-11 15:25:21 -0500
commitce5e831bcfd7daf1a12d488e2857d9424de091dd (patch)
tree3fba12811c386e36349c54f2205db0640ef4351d /spec/models/group_spec.rb
parent800aa296953c4a99e16e0493d9260359ef8c8414 (diff)
downloadgitlab-ce-ce5e831bcfd7daf1a12d488e2857d9424de091dd.tar.gz
Use ILIKE/LIKE for searching groups
Diffstat (limited to 'spec/models/group_spec.rb')
-rw-r--r--spec/models/group_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb
index 3c995053eec..c9245fc9535 100644
--- a/spec/models/group_spec.rb
+++ b/spec/models/group_spec.rb
@@ -103,4 +103,30 @@ describe Group, models: true do
expect(group.avatar_type).to eq(["only images allowed"])
end
end
+
+ describe '.search' do
+ it 'returns groups with a matching name' do
+ expect(described_class.search(group.name)).to eq([group])
+ end
+
+ it 'returns groups with a partially matching name' do
+ expect(described_class.search(group.name[0..2])).to eq([group])
+ end
+
+ it 'returns groups with a matching name regardless of the casing' do
+ expect(described_class.search(group.name.upcase)).to eq([group])
+ end
+
+ it 'returns groups with a matching path' do
+ expect(described_class.search(group.path)).to eq([group])
+ end
+
+ it 'returns groups with a partially matching path' do
+ expect(described_class.search(group.path[0..2])).to eq([group])
+ end
+
+ it 'returns groups with a matching path regardless of the casing' do
+ expect(described_class.search(group.path.upcase)).to eq([group])
+ end
+ end
end