git clone works
[repobrowse.git] / test / test_clone.rb
blobea0d7f43589a89df3d3c0f7096d1ccfc50a9fbe0
1 # Copyright (C) 2017 all contributors <repobrowse@80x24.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3 # frozen_string_literal: true
4 require_relative 'helper'
6 class TestClone < Test::Unit::TestCase
7   def test_clone
8     git_tmp_repo do |tmp_dir, git_dir|
9       projects = { 'repo.tmp.path' => git_dir }
10       app = Rack::Builder.new { run Repobrowse::App.new(projects) }.to_app
11       rack_server(app) do |logq, host, port|
12         url = "http://#{host}:#{port}/tmp"
14         assert system(*%W(git clone -q #{url} #{tmp_dir}/smart)),
15             'smart clone works'
17         assert system(*%W(git --git-dir=#{git_dir} update-server-info)),
18             'enable dumb clones'
19         env = { 'GIT_SMART_HTTP' => '0' }
20         assert system(env, *%W(git clone -q #{url} #{tmp_dir}/dumb)),
21             'dumb clone works'
22       end
23     end
24   end
25 end