Commit 1defb950 authored by Dylan Griffith's avatar Dylan Griffith

Update Factory::Repository::Push to allow pushing directory to simplfy auto devops spec

parent 282c09ed
...@@ -15,15 +15,23 @@ module QA ...@@ -15,15 +15,23 @@ module QA
def initialize def initialize
@file_name = 'file.txt' @file_name = 'file.txt'
@file_content = '# This is test project' @file_content = '# This is test project'
@commit_message = "Add #{@file_name}" @commit_message = "This is a test commit"
@branch_name = 'master' @branch_name = 'master'
@new_branch = true @new_branch = true
@pushing_directory = false
end end
def remote_branch def remote_branch
@remote_branch ||= branch_name @remote_branch ||= branch_name
end end
def directory=(dir)
raise "Must set directory as a Pathname" unless dir.is_a?(Pathname)
@directory = dir
@pushing_directory = true
end
def fabricate! def fabricate!
project.visit! project.visit!
...@@ -43,7 +51,14 @@ module QA ...@@ -43,7 +51,14 @@ module QA
repository.checkout(branch_name) repository.checkout(branch_name)
end end
if @pushing_directory
@directory.each_child do |f|
repository.add_file(f.basename, f.read) if f.file?
end
else
repository.add_file(file_name, file_content) repository.add_file(file_name, file_content)
end
repository.commit(commit_message) repository.commit(commit_message)
repository.push_changes("#{branch_name}:#{remote_branch}") repository.push_changes("#{branch_name}:#{remote_branch}")
end end
......
...@@ -16,25 +16,15 @@ module QA ...@@ -16,25 +16,15 @@ module QA
end end
# Create Auto Devops compatible repo # Create Auto Devops compatible repo
project.visit! Factory::Repository::Push.fabricate! do |push|
Git::Repository.perform do |repository| push.project = project
repository.uri = Page::Project::Show.act do push.directory = Pathname
choose_repository_clone_http .new(__dir__)
repository_location.uri .join('../../../fixtures/auto_devops_rack')
push.commit_message = 'Create Auto DevOps compatible rack application'
end end
repository.use_default_credentials Page::Project::Show.act { wait_for_push }
repository.clone
repository.configure_identity('GitLab QA', 'root@gitlab.com')
repository.checkout_new_branch('master')
repository.add_file('config.ru', File.read(File.join(__dir__, "../../../fixtures/auto_devops_rack/config.ru")))
repository.add_file('Gemfile', File.read(File.join(__dir__, "../../../fixtures/auto_devops_rack/Gemfile")))
repository.add_file('Gemfile.lock', File.read(File.join(__dir__, "../../../fixtures/auto_devops_rack/Gemfile.lock")))
repository.add_file('Rakefile', File.read(File.join(__dir__, "../../../fixtures/auto_devops_rack/Rakefile")))
repository.commit('Create auto devops repo')
repository.push_changes("master:master")
end
# Create and connect K8s cluster # Create and connect K8s cluster
@cluster = Service::KubernetesCluster.new.create! @cluster = Service::KubernetesCluster.new.create!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment