summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2017-05-17 17:01:19 -0700
committerMichael Kozono <mkozono@gmail.com>2017-05-17 17:12:09 -0700
commit8d4cc9cbe07d96ee34dd2559e34b38b712c3b3b4 (patch)
tree015d7e518cb71d37bd0a5098da96a37a5f3eaf48 /spec/models
parent0b946a7bc69058a952a558a9530cd3e8302361e7 (diff)
downloadgitlab-ce-8d4cc9cbe07d96ee34dd2559e34b38b712c3b3b4.tar.gz
Fixes #32474
Older namespace records may be both `type == ‘Group` AND `owner_id` is not null.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/user_spec.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index e6e7774431e..6a15830a15c 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -929,10 +929,20 @@ describe User, models: true do
end
context 'with a group route matching the given path' do
- let!(:group) { create(:group, path: 'group_path') }
+ context 'when the group namespace has an owner_id (legacy data)' do
+ let!(:group) { create(:group, path: 'group_path', owner: user) }
- it 'returns nil' do
- expect(User.find_by_full_path('group_path')).to eq(nil)
+ it 'returns nil' do
+ expect(User.find_by_full_path('group_path')).to eq(nil)
+ end
+ end
+
+ context 'when the group namespace does not have an owner_id' do
+ let!(:group) { create(:group, path: 'group_path') }
+
+ it 'returns nil' do
+ expect(User.find_by_full_path('group_path')).to eq(nil)
+ end
end
end
end