Sha256: 9fe3d5c60c1e33de5fb88c479039739c60e3b776945a6eb6d8bbfcdcc87ea01d

Contents?: true

Size: 1.67 KB

Versions: 4

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'

describe Gitolite::GitoliteAdmin do

  conf_dir   = File.join(File.dirname(__FILE__), 'fixtures', 'configs')
  output_dir = '/tmp'
  # output_dir = File.join(File.dirname(File.dirname(__FILE__)), 'tmp')

  describe '#bootstrap' do
    it 'should bootstrap a gitolite-admin repository' do
      test_dir = File.join(output_dir, 'gitolite-admin-test1')
      opts = { :overwrite => false }
      gl_admin = GitoliteAdmin.bootstrap(test_dir, opts)

      expect(gl_admin).to be_a Gitolite::GitoliteAdmin
      expect(GitoliteAdmin.is_gitolite_admin_repo?(test_dir)).to be true
    end

    it 'should bootstrap (overwrite) a gitolite-admin repository' do
      test_dir = File.join(output_dir, 'gitolite-admin-test1')
      opts = { :overwrite => true }
      gl_admin = GitoliteAdmin.bootstrap(test_dir, opts)

      expect(gl_admin).to be_a Gitolite::GitoliteAdmin
      expect(GitoliteAdmin.is_gitolite_admin_repo?(test_dir)).to be true
    end
  end

  describe '#is_gitolite_admin_repo?' do
    it 'should detect a non gitolite-admin repository' do
      test_dir = output_dir
      expect(GitoliteAdmin.is_gitolite_admin_repo?(test_dir)).to be false
    end
  end

  describe '#save' do
    it 'should commit file to gitolite-admin repository' do
      test_dir = File.join(output_dir, 'gitolite-admin-test2')
      opts = { :overwrite => true }
      gl_admin = GitoliteAdmin.bootstrap(test_dir, opts)

      c = Gitolite::Config.new(File.join(conf_dir, 'complicated.conf'))
      c.filename = 'gitolite.conf'

      gl_admin.config = c
      gl_admin.save

      new_file = File.join(test_dir, 'conf', c.filename)
      expect(File.file?(new_file)).to be true
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jbox-gitolite-1.2.6 spec/gitolite_admin_spec.rb
jbox-gitolite-1.2.5 spec/gitolite_admin_spec.rb
jbox-gitolite-1.2.4 spec/gitolite_admin_spec.rb
jbox-gitolite-1.2.3 spec/gitolite_admin_spec.rb