summaryrefslogtreecommitdiff
path: root/spec/factories
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-06-01 17:42:38 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-06-01 17:42:38 +0800
commit99b142bcf6be3c5f6a9265bb9d2ff43c6b6e2b0c (patch)
tree4275179c328e4763cde96c5e4b2b89023eac4866 /spec/factories
parent9e60d57d9fec420ed2c68d6fe1d3e1af90abb4c5 (diff)
parentf74f03383f5ea1e6243eff1b091211e28c5ddbf1 (diff)
downloadgitlab-ce-99b142bcf6be3c5f6a9265bb9d2ff43c6b6e2b0c.tar.gz
Merge remote-tracking branch 'upstream/master' into 25680-CI_ENVIRONMENT_URL
* upstream/master: (251 commits) Don't match email addresses or foo@bar as user references Revert "Update GITLAB_SHELL_VERSION" Update GITLAB_SHELL_VERSION Add feature toggles through Flipper Change no_limits to limits Move includes call to scope Add GitLab Resources to University Add Documentation for GIT_CHECKOUT variable Remove entry variable Do not try to preload Commits when using Note.includes(:noteable) Ui improvements for count badges and permission badges Rename the other jobs Update jobs_spec for changes from builds_spec Introduce source to pipeline entity Update docs related to protected actions Add changelog for protected branches abilities fix Ask for an example project for bug reports Center loading spinner in issuable filters Fix chat commands specs related to protected actions Fix builds controller specs related to protected actions ...
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/ci/pipelines.rb1
-rw-r--r--spec/factories/projects.rb12
2 files changed, 13 insertions, 0 deletions
diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb
index 361c5b9a49e..03e3c62effe 100644
--- a/spec/factories/ci/pipelines.rb
+++ b/spec/factories/ci/pipelines.rb
@@ -1,5 +1,6 @@
FactoryGirl.define do
factory :ci_empty_pipeline, class: Ci::Pipeline do
+ source :push
ref 'master'
sha '97de212e80737a608d939f648d959671fb0a0142'
status 'pending'
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb
index 7a76f5f8afc..e8a9b688319 100644
--- a/spec/factories/projects.rb
+++ b/spec/factories/projects.rb
@@ -109,6 +109,18 @@ FactoryGirl.define do
merge_requests_access_level: merge_requests_access_level,
repository_access_level: evaluator.repository_access_level
)
+
+ # Normally the class Projects::CreateService is used for creating
+ # projects, and this class takes care of making sure the owner and current
+ # user have access to the project. Our specs don't use said service class,
+ # thus we must manually refresh things here.
+ owner = project.owner
+
+ if owner && owner.is_a?(User) && !project.pending_delete
+ project.members.create!(user: owner, access_level: Gitlab::Access::MASTER)
+ end
+
+ project.group&.refresh_members_authorized_projects
end
end