Sha256: 4774d054405f5657f09aa939ea05f78108ed17081f74d1315ceb94dd8c092b23

Contents?: true

Size: 793 Bytes

Versions: 7

Compression:

Stored size: 793 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/envs'
require 'tmpdir'

module EacGit
  module Rspec
    module StubbedGitLocalRepo
      def stubbed_git_local_repo(bare = false) # rubocop:disable Style/OptionalBooleanParameter
        path = ::Dir.mktmpdir
        ::EacRubyUtils::Envs.local.command(stubbed_git_local_repo_args(path, bare)).execute!
        repo = ::EacGit::Rspec::StubbedGitLocalRepo::Repository.new(path)
        repo.command('config', 'user.email', 'theuser@example.net').execute!
        repo.command('config', 'user.name', 'The User').execute!
        repo
      end

      private

      def stubbed_git_local_repo_args(path, bare)
        r = %w[git init]
        r << '--bare' if bare
        r + [path]
      end

      require_sub __FILE__
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
eac_tools-0.86.5 sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb
eac_tools-0.86.4 sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb
eac_tools-0.86.3 sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb
eac_git-0.16.0 lib/eac_git/rspec/stubbed_git_local_repo.rb
eac_tools-0.86.2 sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb
eac_git-0.15.0 lib/eac_git/rspec/stubbed_git_local_repo.rb
eac_tools-0.84.2 sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb