Sha256: f994741d2dcffb5a6626aab070d26f243ed4fac6df118b5318caa95fe2352f91
Contents?: true
Size: 884 Bytes
Versions: 1
Compression:
Stored size: 884 Bytes
Contents
require 'tmpdir' require 'fileutils' require 'securerandom' module GitRepository extend RSpec::SharedContext let(:repo) { @repo } before(:each) { create_sample_repo } after(:each) { remove_sample_repo } def create_sample_repo @previous_dir = Dir.pwd @repo = Dir.mktmpdir 'git_shizzle' Dir.chdir(@repo) `git init` `git config user.name somebody` `git config user.email somebody@example.com` end def create(file) FileUtils.touch file modify(file) end def modify(file) File.write file, ::SecureRandom.uuid end def move(src, dst) FileUtils.mv src, dst, :verbose => true end def delete(file) FileUtils.rm file end def stage(file = nil) `git add --all #{file}` end def remove_sample_repo Dir.chdir(@previous_dir) FileUtils.rm_rf @repo end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
git_shizzle-0.2.6 | spec/helpers/git_repository.rb |