Sha256: 51b7eb00acc396c5f636b51bfa4884207ad89ec3c34c865ad306dd333bbd4b17

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'

require 'minitest/autorun'
require_relative 'test_helper'
require 'fileutils'
require 'git'

SANDBOX = 'commit'
ROOT = "#{SANDBOX}-sandbox/modules/foo"
class GitTest < MiniTest::Unit::TestCase
  include FileUtils

  def setup
    Opsk::Root.start ['generate_puppet', 'commit', 'bar']
    mkdir_p(ROOT)
    mkdir_p("#{SANDBOX}-sandbox/modules/non-git")
    g = Git.init(ROOT)
    g.add_remote('origin','git://github.com/foo/bar.git') 
    touch("#{ROOT}/bla.txt")
    g.add('bla.txt')
    g.commit_all('message')
    open("#{ROOT}/bla.txt", 'a') { |f| f.puts 'Hello, world.'}
  end

  def teardown 
    rm_rf "#{SANDBOX}-sandbox"
  end

  def with_cwd(dir)
    Dir.chdir dir do
	yield  
    end
  end

  def test_commit
    with_cwd "#{SANDBOX}-sandbox" do
	 Opsk::Root.start ['commit', '--message', 'some message', '--all', 'true']
    end 	
    g = Git.init(ROOT)
    assert g.show.include? 'some message'
  end

  def test_writeable
    with_cwd "#{SANDBOX}-sandbox" do
	 Opsk::Root.start ['push', '--dry', 'true']
    end 	
    g = Git.init(ROOT)
    assert g.remotes.length == 2
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opskeleton-0.9.3 test/git_test.rb
opskeleton-0.9.2 test/git_test.rb
opskeleton-0.9.1 test/git_test.rb
opskeleton-0.9.0 test/git_test.rb