Module: Git::TestHelpers

Defined in:
lib/git/git_test_helpers.rb

Class Method Summary collapse

Class Method Details

.create_branch(repository_name: 'repository_name', name: 'path/branch', last_modified_date: Time.current, author_name: 'Author Name', author_email: '[email protected]') ⇒ Object



11
12
13
14
15
16
17
# File 'lib/git/git_test_helpers.rb', line 11

def self.create_branch(repository_name: 'repository_name',
                       name: 'path/branch',
                       last_modified_date: Time.current,
                       author_name: 'Author Name',
                       author_email: '[email protected]')
  GitBranch.new(repository_name, name, last_modified_date, author_name, author_email)
end

.create_commit(sha: '1234567890123456789012345678901234567890', message: 'Commit message', author_name: 'Author Name', author_email: '[email protected]', commit_date: Time.current) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/git/git_test_helpers.rb', line 26

def self.create_commit(sha: '1234567890123456789012345678901234567890',
                       message: 'Commit message',
                       author_name: 'Author Name',
                       author_email: '[email protected]',
                       commit_date: Time.current)
  GitCommit.new(sha, message, commit_date, author_name, author_email)
end

.create_conflict(repository_name: 'repository_name', branch_a_name: 'branch_a', branch_b_name: 'branch_b', file_list: ['file1', 'file2']) ⇒ Object



19
20
21
22
23
24
# File 'lib/git/git_test_helpers.rb', line 19

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

.create_shaObject



34
35
36
# File 'lib/git/git_test_helpers.rb', line 34

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