Sha256: 127ba78ed63d762091bbcf4a3e1dbca3bbc7d053f939a671a071648a4ca0fb82

Contents?: true

Size: 1.09 KB

Versions: 13

Compression:

Stored size: 1.09 KB

Contents

require 'fedux_org/stdlib/filesystem'

module LocalPac
  module SpecHelper
    module GitHelper
      include FeduxOrg::Stdlib::Filesystem

      def root_directory
        ::File.expand_path('../../../', __FILE__)
      end

      def git_init(path)
        switch_to_working_directory do
          Git.init(path)
        end

        File.join(working_directory, path)
      end

      def git_add(repo, object)
        Dir.chdir(::File.join(working_directory, repo)) do
          Git.add(object)
        end

        File.join(working_directory, repo, object)
      end

      def git_status(repo)
        Dir.chdir(::File.join(working_directory, repo)) do
          Git.status
        end
      end

      def git_commit(repo, message = 'Yay... Added objects')
        Dir.chdir(::File.join(working_directory, repo)) do
          Git.commit(message)
        end
      end

      def git_show(repo, sha)
        Dir.chdir(::File.join(working_directory, repo)) do
          Git.show(sha)
        end
      end
    end
  end
end

# encoding: utf-8
RSpec.configure do |c|
  c.include LocalPac::SpecHelper::GitHelper
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
local_pac-0.1.13 spec/support/git.rb
local_pac-0.1.11 spec/support/git.rb
local_pac-0.1.10 spec/support/git.rb
local_pac-0.1.9 spec/support/git.rb
local_pac-0.1.8 spec/support/git.rb
local_pac-0.1.7 spec/support/git.rb
local_pac-0.1.6 spec/support/git.rb
local_pac-0.1.5 spec/support/git.rb
local_pac-0.1.4 spec/support/git.rb
local_pac-0.1.3 spec/support/git.rb
local_pac-0.1.2 spec/support/git.rb
local_pac-0.1.1 spec/support/git.rb
local_pac-0.1.0 spec/support/git.rb