Sha256: b67e92b724a7ed7e250ee5b758784643c84626861dc0043c03bc3ac07e2c287e

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

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

class GitTest < Test::Unit::TestCase

  def setup
    @scm = new_scm(Provisional::SCM::Git)
  end

  def test_init
    FileUtils.expects(:mkdir_p).with('name')
    Dir.expects(:chdir).with('name')
    Git.expects(:init)
    @scm.init
  end

  def test_init_should_fail_if_any_step_raises_any_exception
    FileUtils.expects(:mkdir_p).with('name').raises(Errno::EEXIST)
    assert_raise RuntimeError do
      @scm.init
    end
  end

  def test_generate_rails
    Provisional::RailsApplication.expects(:new)
    @scm.generate_rails
  end

  def test_generate_rails_should_fail_if_any_step_raises_any_exception
    Provisional::RailsApplication.expects(:new).raises(RuntimeError)
    assert_raise RuntimeError do
      @scm.generate_rails
    end
  end

  def test_checkin
    stub_git_checkin
    @scm.checkin
  end

  def test_checkin_should_fail_if_any_step_raises_any_exception
    Git.expects(:open).raises(ArgumentError)
    assert_raise RuntimeError do
      @scm.checkin
    end
  end
  
  def test_provision_should_call_init_generate_rails_and_checkin
    @scm.expects(:init)
    @scm.expects(:generate_rails)
    @scm.expects(:checkin)
    @scm.provision
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vigetlabs-provisional-2.1.11 test/unit/git_test.rb
vigetlabs-provisional-2.1.12 test/unit/git_test.rb
vigetlabs-provisional-2.1.7 test/unit/git_test.rb
vigetlabs-provisional-2.1.8 test/unit/git_test.rb
vigetlabs-provisional-2.1.9 test/unit/git_test.rb