Sha256: b0126500d6e0d51402ef4e35c6e819c2894feafddf8d794d43e381645189aa12

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'
require File.dirname(__FILE__) + '/../../lib/provisional/scm/repo_man_git'

class RepoManGitTest < Test::Unit::TestCase
  def setup
    @scm = Provisional::SCM::RepoManGit.new(
    {
      'name' => 'name',
      'template_path' => 'template_path',
      'domain' => 'example.com'
    }
    )
  end

  def test_checkin
    repo_stub = stub()
    repo_stub.expects(:add).with('.')
    repo_stub.expects(:commit).with('Initial commit by Provisional')
    repo_stub.expects(:add_remote)
    repo_stub.expects(:push)

    Git.expects(:open).returns(repo_stub)
    Dir.expects(:chdir)

    RepoMan::Repository.expects(:create).with(:name => 'name', :scm => 'git')

    @scm.checkin
  end

  def test_checkin_should_raise_RuntimeError_if_any_step_raises_any_exception
    repo_stub = stub()
    repo_stub.expects(:add).with('.')
    repo_stub.expects(:commit).with('Initial commit by Provisional')

    Git.expects(:open).returns(repo_stub)
    Dir.expects(:chdir)

    RepoMan::Repository.expects(:create).with(:name => 'name', :scm => 'git').raises(Errno::ECONNREFUSED)

    assert_raise RuntimeError do
      @scm.checkin
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vigetlabs-provisional-repoman-2.1.3 test/unit/repo_man_git_test.rb