diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 15:08:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 15:08:52 +0000 |
commit | 0ab47b994caa80c5587f33dc818626b66cfdafe2 (patch) | |
tree | 5ef3976d2f84e3368903a67ba2dbd87a74b9a43c /spec/factories | |
parent | 1308dc5eb484ab0f8064989fc551ebdb4b1a7976 (diff) | |
download | gitlab-ce-0ab47b994caa80c5587f33dc818626b66cfdafe2.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/factories')
-rw-r--r-- | spec/factories/snippet_repositories.rb | 12 | ||||
-rw-r--r-- | spec/factories/snippets.rb | 15 |
2 files changed, 27 insertions, 0 deletions
diff --git a/spec/factories/snippet_repositories.rb b/spec/factories/snippet_repositories.rb new file mode 100644 index 00000000000..1f9e68514bb --- /dev/null +++ b/spec/factories/snippet_repositories.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :snippet_repository do + snippet + + after(:build) do |snippet_repository, _| + snippet_repository.shard_name = snippet_repository.snippet.repository_storage + snippet_repository.disk_path = snippet_repository.snippet.disk_path + end + end +end diff --git a/spec/factories/snippets.rb b/spec/factories/snippets.rb index 5990ed7ffb0..6fcb0319748 100644 --- a/spec/factories/snippets.rb +++ b/spec/factories/snippets.rb @@ -20,6 +20,21 @@ FactoryBot.define do trait :private do visibility_level { Snippet::PRIVATE } end + + # Test repository - https://gitlab.com/gitlab-org/gitlab-test + trait :repository do + after :create do |snippet| + TestEnv.copy_repo(snippet, + bare_repo: TestEnv.factory_repo_path_bare, + refs: TestEnv::BRANCH_SHA) + end + end + + trait :empty_repo do + after(:create) do |snippet| + raise "Failed to create repository!" unless snippet.repository.create_if_not_exists + end + end end factory :project_snippet, parent: :snippet, class: :ProjectSnippet do |