Class: EacGit::Rspec::StubbedGitLocalRepo::Repository

Inherits:
Local
  • Object
show all
Defined in:
lib/eac_git/rspec/stubbed_git_local_repo/repository.rb

Constant Summary

Constants inherited from Local

Local::HEAD_REFERENCE

Instance Method Summary collapse

Methods inherited from Local

#<=>, #branch, #command, #commit, #commitize, #current_branch, #descendant?, find, #head, #merge_base, #raise_error, #rev_parse, #subrepo, #subrepos, #to_s

Instance Method Details

#directory(*subpath) ⇒ EacGit::Rspec::StubbedGitLocalRepo::Directory



14
15
16
# File 'lib/eac_git/rspec/stubbed_git_local_repo/repository.rb', line 14

def directory(*subpath)
  ::EacGit::Rspec::StubbedGitLocalRepo::Directory.new(self, subpath)
end

#file(*subpath) ⇒ Object



18
19
20
# File 'lib/eac_git/rspec/stubbed_git_local_repo/repository.rb', line 18

def file(*subpath)
  ::EacGit::Rspec::StubbedGitLocalRepo::File.new(self, subpath)
end

#random_commitEacGit::Local::Commit

Returns EacGit::Local::Commit.

Returns:



23
24
25
26
27
28
29
30
# File 'lib/eac_git/rspec/stubbed_git_local_repo/repository.rb', line 23

def random_commit
  content = ::SecureRandom.hex
  file = "#{content}.txt"
  file(file).write(content)
  command('add', file).execute!
  command('commit', '-m', "Random commit: #{file}.").execute!
  head
end