diff options
Diffstat (limited to 'spec/services/design_management')
3 files changed, 17 insertions, 5 deletions
diff --git a/spec/services/design_management/copy_design_collection/copy_service_spec.rb b/spec/services/design_management/copy_design_collection/copy_service_spec.rb index 186d2481c19..89a78c9bf5f 100644 --- a/spec/services/design_management/copy_design_collection/copy_service_spec.rb +++ b/spec/services/design_management/copy_design_collection/copy_service_spec.rb @@ -191,8 +191,8 @@ RSpec.describe DesignManagement::CopyDesignCollection::CopyService, :clean_gitla expect(commits_on_master(limit: 99)).to include(*target_issue.design_versions.ordered.pluck(:sha)) end - it 'creates a master branch if none previously existed' do - expect { subject }.to change { target_repository.branch_names }.from([]).to(['master']) + it 'creates a default branch if none previously existed' do + expect { subject }.to change { target_repository.branch_names }.from([]).to([project.design_repository.root_ref]) end it 'does not create default branch when one exists' do @@ -255,7 +255,7 @@ RSpec.describe DesignManagement::CopyDesignCollection::CopyService, :clean_gitla end def commits_on_master(limit: 10) - target_repository.commits('master', limit: limit).map(&:id) + target_repository.commits(target_repository.root_ref, limit: limit).map(&:id) end end end diff --git a/spec/services/design_management/copy_design_collection/queue_service_spec.rb b/spec/services/design_management/copy_design_collection/queue_service_spec.rb index 2d9ea4633a0..05a7b092ccf 100644 --- a/spec/services/design_management/copy_design_collection/queue_service_spec.rb +++ b/spec/services/design_management/copy_design_collection/queue_service_spec.rb @@ -39,7 +39,7 @@ RSpec.describe DesignManagement::CopyDesignCollection::QueueService, :clean_gitl expect { subject }.to change { target_issue.design_collection.copy_state }.from('ready').to('in_progress') end - it 'queues a DesignManagement::CopyDesignCollectionWorker' do + it 'queues a DesignManagement::CopyDesignCollectionWorker', :clean_gitlab_redis_queues do expect { subject }.to change(DesignManagement::CopyDesignCollectionWorker.jobs, :size).by(1) end diff --git a/spec/services/design_management/save_designs_service_spec.rb b/spec/services/design_management/save_designs_service_spec.rb index 5bc763cc95e..b76c91fbac9 100644 --- a/spec/services/design_management/save_designs_service_spec.rb +++ b/spec/services/design_management/save_designs_service_spec.rb @@ -177,6 +177,18 @@ RSpec.describe DesignManagement::SaveDesignsService do end end + context 'when HEAD branch is different from master' do + before do + stub_feature_flags(main_branch_over_master: true) + end + + it 'does not raise an exception during update' do + run_service + + expect { run_service }.not_to raise_error + end + end + context 'when a design is being updated' do before do run_service @@ -343,7 +355,7 @@ RSpec.describe DesignManagement::SaveDesignsService do path = File.join(build(:design, issue: issue, filename: filename).full_path) design_repository.create_if_not_exists design_repository.create_file(user, path, 'something fake', - branch_name: 'master', + branch_name: project.default_branch_or_main, message: 'Somehow created without being tracked in db') end |