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:
Diffstat (limited to 'spec/factories/protected_branches.rb')
-rw-r--r--spec/factories/protected_branches.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/factories/protected_branches.rb b/spec/factories/protected_branches.rb
index 2d3abc77350..bac1cf21596 100644
--- a/spec/factories/protected_branches.rb
+++ b/spec/factories/protected_branches.rb
@@ -2,7 +2,7 @@
FactoryBot.define do
factory :protected_branch do
- name
+ sequence(:name) { |n| "protected_branch_#{n}" }
project
transient do
@@ -11,6 +11,20 @@ FactoryBot.define do
default_access_level { true }
end
+ trait :create_branch_on_repository do
+ association :project, factory: [:project, :repository]
+
+ transient do
+ repository_branch_name { name }
+ end
+
+ after(:create) do |protected_branch, evaluator|
+ project = protected_branch.project
+
+ project.repository.create_branch(evaluator.repository_branch_name, project.default_branch_or_main)
+ end
+ end
+
trait :developers_can_push do
transient do
default_push_level { false }