diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-07-03 14:05:09 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-07-03 14:05:09 +0000 |
commit | ff34ba025d7b8dcc305d060a5c82ebf09675ba57 (patch) | |
tree | f686652f00a4974b20ff88342bb78ec9dcfccd7d /db | |
parent | c489d53b2e2eecb22f8dc7034da142221220e89f (diff) | |
parent | f86d31c1b0429c890adee7edee554d052816a91f (diff) | |
download | gitlab-ce-ff34ba025d7b8dcc305d060a5c82ebf09675ba57.tar.gz |
Merge branch 'dz-dry-nested-group-fixtures' into 'master'
DRY group creation code in nested groups fixtures
See merge request gitlab-org/gitlab-ce!20314
Diffstat (limited to 'db')
-rw-r--r-- | db/fixtures/development/20_nested_groups.rb | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/db/fixtures/development/20_nested_groups.rb b/db/fixtures/development/20_nested_groups.rb index 2bc78e120a5..3d95e243f8a 100644 --- a/db/fixtures/development/20_nested_groups.rb +++ b/db/fixtures/development/20_nested_groups.rb @@ -1,30 +1,5 @@ require './spec/support/sidekiq' -def create_group_with_parents(user, full_path) - parent_path = nil - group = nil - - until full_path.blank? - path, _, full_path = full_path.partition('/') - - if parent_path - parent = Group.find_by_full_path(parent_path) - - parent_path += '/' - parent_path += path - - group = Groups::CreateService.new(user, path: path, parent_id: parent.id).execute - else - parent_path = path - - group = Group.find_by_full_path(parent_path) || - Groups::CreateService.new(user, path: path).execute - end - end - - group -end - Sidekiq::Testing.inline! do Gitlab::Seeder.quiet do flag = 'SEED_NESTED_GROUPS' @@ -48,7 +23,8 @@ Sidekiq::Testing.inline! do full_path = url.sub('https://android.googlesource.com/', '') full_path = full_path.sub(/\.git\z/, '') full_path, _, project_path = full_path.rpartition('/') - group = Group.find_by_full_path(full_path) || create_group_with_parents(user, full_path) + group = Group.find_by_full_path(full_path) || + Groups::NestedCreateService.new(user, group_path: full_path).execute params = { import_url: url, |