diff options
Diffstat (limited to 'spec/factories/snippets.rb')
-rw-r--r-- | spec/factories/snippets.rb | 15 |
1 files changed, 15 insertions, 0 deletions
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 |