Sha256: ce6844d39f4b5ad2f48f0220b6b446ab27d480c1c8c84572fab99322bade3073
Contents?: true
Size: 775 Bytes
Versions: 1
Compression:
Stored size: 775 Bytes
Contents
# frozen_string_literal: true module RepositoryHelper REPOSITORY_TEST_DIR = File.join(ROOT_DIR, "tmp/examples") def prepare_repository(dir_name) directory = directory_path(dir_name) FileUtils.rm_rf directory FileUtils.mkdir_p directory Dir.chdir directory do `git init .` `git branch -m main` create_commit "Initial commit", "" yield end end def in_repository(dir_name, &block) directory = directory_path(dir_name) Dir.chdir(directory, &block) end def directory_path(dir_name) File.join(REPOSITORY_TEST_DIR, dir_name) end def checkout_branch(name) `git checkout -b "#{name}"` end def create_commit(subject, message) `git commit --allow-empty -m "#{subject}" -m "#{message}"` end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
commit_format-0.1.0 | spec/support/repository_helper.rb |