Sha256: 59ee0297483fce139b31a2c640010d0366628a3bebc0433e147d210066a4a404

Contents?: true

Size: 1.01 KB

Versions: 23

Compression:

Stored size: 1.01 KB

Contents

require "rspec"
require "gitlab_exporter"

require "open3"
require "tmpdir"

$LOAD_PATH.unshift File.expand_path(".")
Dir["spec/support/**/*.rb"].each do |f| require f end

class GitRepoBuilder
  def origin
    @origin ||= create_origin
  end

  def cloned_repo
    @cloned_repo ||= clone_origin
  end

  def cleanup
    FileUtils.rm_r(@origin) if @origin
    FileUtils.rm_r(@cloned_repo) if @cloned_repo
  end

  private

  def create_origin
    path = Dir.mktmpdir
    Open3.capture3("git init", chdir: path)
    Open3.capture3("git commit --allow-empty -m 'Beep'", chdir: path)
    Open3.capture3("git checkout -b other", chdir: path)
    path
  end

  def clone_origin
    path = Dir.mktmpdir
    Dir.rmdir(path)
    Open3.capture3("git clone #{origin} #{path}")
    Open3.capture3("git checkout master", chdir: path)
    path
  end
end

class CLIArgs
  def initialize(args)
    @arguments = args
  end

  def options
    yield self
  end

  def on(*args); end

  def banner=(banner); end

  def parse!
    @arguments
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
gitlab-exporter-11.18.2 spec/spec_helper.rb
gitlab-exporter-11.18.1 spec/spec_helper.rb
gitlab-exporter-11.18.0 spec/spec_helper.rb
gitlab-exporter-11.17.1 spec/spec_helper.rb
gitlab-exporter-11.17.0 spec/spec_helper.rb
gitlab-exporter-11.16.0 spec/spec_helper.rb
gitlab-exporter-11.15.2 spec/spec_helper.rb
gitlab-exporter-11.15.1 spec/spec_helper.rb
gitlab-exporter-11.15.0 spec/spec_helper.rb
gitlab-exporter-11.14.0 spec/spec_helper.rb
gitlab-exporter-11.13.1 spec/spec_helper.rb
gitlab-exporter-11.13.0 spec/spec_helper.rb
gitlab-exporter-11.12.0 spec/spec_helper.rb
gitlab-exporter-11.11.0 spec/spec_helper.rb
gitlab-exporter-11.10.0 spec/spec_helper.rb
gitlab-exporter-11.9.0 spec/spec_helper.rb
gitlab-exporter-11.8.0 spec/spec_helper.rb
gitlab-exporter-11.7.0 spec/spec_helper.rb
gitlab-exporter-11.6.0 spec/spec_helper.rb
gitlab-exporter-11.5.0 spec/spec_helper.rb