From 07b9b80a8833cf44ba804c9b8dfdf1550785fe83 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 8 Dec 2016 19:11:52 +0800 Subject: Fix tests to use the new API --- spec/factories/projects.rb | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'spec/factories') diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 1166498ddff..aa971e12a2e 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -91,8 +91,40 @@ FactoryGirl.define do factory :project, parent: :empty_project do path { 'gitlabhq' } - after :create do |project| + transient do + create_template nil + end + + after :create do |project, evaluator| TestEnv.copy_repo(project) + + if evaluator.create_template + args = evaluator.create_template + + project.add_user(args[:user], args[:access]) + + project.repository.commit_file( + args[:user], + ".gitlab/#{args[:path]}/bug.md", + 'something valid', + message: 'test 3', + branch_name: 'master', + update: false) + project.repository.commit_file( + args[:user], + ".gitlab/#{args[:path]}/template_test.md", + 'template_test', + message: 'test 1', + branch_name: 'master', + update: false) + project.repository.commit_file( + args[:user], + ".gitlab/#{args[:path]}/feature_proposal.md", + 'feature_proposal', + message: 'test 2', + branch_name: 'master', + update: false) + end end end -- cgit v1.2.1