Skip to content

Commit

Permalink
Move helpers into their own module
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeweaver committed Nov 23, 2016
1 parent 2590efe commit f3f3744
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions lib/git/git_test_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,32 @@
require_relative './git_commit.rb'

module Git
def create_test_git_branch(repository_name: 'repository_name',
name: 'path/branch',
last_modified_date: Time.current,
author_name: 'Author Name',
author_email: 'author@email.com')
Git::GitBranch.new(repository_name, name, last_modified_date, author_name, author_email)
end
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')
Git::GitBranch.new(repository_name, name, last_modified_date, author_name, author_email)
end

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

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

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

0 comments on commit f3f3744

Please sign in to comment.