summaryrefslogtreecommitdiff
path: root/spec/factories
diff options
context:
space:
mode:
authorDylan Griffith <dyl.griffith@gmail.com>2018-04-26 09:45:01 +0800
committerDylan Griffith <dyl.griffith@gmail.com>2018-04-26 09:45:01 +0800
commitc80e6b9c1229776cf5af065954b99c182cc046c2 (patch)
tree5b9d1ca0c9f0101fd663fd83d68012c49f0ab54b /spec/factories
parent51cc01b6c9468056f40cdc8deb0e4b6414a3ccb9 (diff)
parent55f07cc32e7684b21e0c1662c70128df14c6abf7 (diff)
downloadgitlab-ce-c80e6b9c1229776cf5af065954b99c182cc046c2.tar.gz
Merge branch 'master' into siemens-runner-per-group
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/deploy_tokens.rb8
-rw-r--r--spec/factories/projects.rb13
2 files changed, 19 insertions, 2 deletions
diff --git a/spec/factories/deploy_tokens.rb b/spec/factories/deploy_tokens.rb
index 5fea4a9d5a6..017e866e69c 100644
--- a/spec/factories/deploy_tokens.rb
+++ b/spec/factories/deploy_tokens.rb
@@ -10,5 +10,13 @@ FactoryBot.define do
trait :revoked do
revoked true
end
+
+ trait :gitlab_deploy_token do
+ name DeployToken::GITLAB_DEPLOY_TOKEN_NAME
+ end
+
+ trait :expired do
+ expires_at { Date.today - 1.month }
+ end
end
end
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb
index 6b32629eb58..3d2810bfdba 100644
--- a/spec/factories/projects.rb
+++ b/spec/factories/projects.rb
@@ -154,7 +154,15 @@ FactoryBot.define do
# We delete hooks so that gitlab-shell will not try to authenticate with
# an API that isn't running
- FileUtils.rm_r(File.join(project.repository_storage_path, "#{project.disk_path}.git", 'hooks'))
+ project.gitlab_shell.rm_directory(project.repository_storage,
+ File.join("#{project.disk_path}.git", 'hooks'))
+ end
+ end
+
+ trait :stubbed_repository do
+ after(:build) do |project|
+ allow(project).to receive(:empty_repo?).and_return(false)
+ allow(project.repository).to receive(:empty?).and_return(false)
end
end
@@ -172,7 +180,8 @@ FactoryBot.define do
after(:create) do |project|
raise "Failed to create repository!" unless project.create_repository
- FileUtils.rm_r(File.join(project.repository_storage_path, "#{project.disk_path}.git", 'refs'))
+ project.gitlab_shell.rm_directory(project.repository_storage,
+ File.join("#{project.disk_path}.git", 'refs'))
end
end