summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-08-16 12:45:48 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-08-16 12:45:48 +0530
commit37651d2f4ce12c16945a5b67360c67768cddb465 (patch)
tree4863def680454b8aa26bafedf6cd119094bb0a0d
parent4ddbbcd11a6f03ae36efd4b9016974c34a1465ed (diff)
downloadgitlab-ce-37651d2f4ce12c16945a5b67360c67768cddb465.tar.gz
Fix the protected branches factory.
1. Previously, we were using `after_create` to create access levels. 2. At the time of protected branch creation, there are _no_ access levels present, which is invalid, and creation fails. 3. Fixed by setting access levels before the protected branch is created.
-rw-r--r--spec/factories/protected_branches.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/spec/factories/protected_branches.rb b/spec/factories/protected_branches.rb
index 3b21174987f..42853cac112 100644
--- a/spec/factories/protected_branches.rb
+++ b/spec/factories/protected_branches.rb
@@ -3,9 +3,9 @@ FactoryGirl.define do
name
project
- after(:create) do |protected_branch|
- protected_branch.push_access_levels.create!(access_level: Gitlab::Access::MASTER)
- protected_branch.merge_access_levels.create!(access_level: Gitlab::Access::MASTER)
+ before(:create) do |protected_branch|
+ protected_branch.push_access_levels.new(access_level: Gitlab::Access::MASTER)
+ protected_branch.merge_access_levels.new(access_level: Gitlab::Access::MASTER)
end
trait :developers_can_push do