Sha256: c170d2fbdcd9c037e1a823693cf54f7438259d23e7e89b8e2310284e362dc0db

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

# frozen_string_literal: true

require 'digest/sha1'
require 'securerandom'
require_relative './git_branch.rb'
require_relative './git_conflict.rb'
require_relative './git_commit.rb'

module Git
  module TestHelpers
    def self.create_branch(repository_name: 'repository_name',
                           name: 'path/branch',
                           last_modified_date: Time.current,
                           author_name: 'Author Name',
                           author_email: 'author@email.com')
      GitBranch.new(repository_name, name, last_modified_date, author_name, author_email)
    end

    def self.create_conflict(repository_name: 'repository_name',
                             branch_a_name: 'branch_a',
                             branch_b_name: 'branch_b',
                             file_list: ['file1', 'file2'])
      GitConflict.new(repository_name, branch_a_name, branch_b_name, file_list)
    end

    def self.create_commit(repository_name: 'repository',
                           sha: '1234567890123456789012345678901234567890',
                           message: 'Commit message',
                           author_name: 'Author Name',
                           author_email: 'author@email.com',
                           commit_date: Time.current)
      GitCommit.new(sha, message, commit_date, author_name, author_email, repository_name: repository_name)
    end

    def self.create_sha
      Digest::SHA1.hexdigest(SecureRandom.hex)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
git_lib-2.1.0 lib/git/git_test_helpers.rb
git_lib-2.0.0 lib/git/git_test_helpers.rb
git_lib-2.0.0.pre.1 lib/git/git_test_helpers.rb
git_lib-1.3.0.pre.1 lib/git/git_test_helpers.rb