Sha256: c0ec369435f158239c76ca2995cfeb524b367f70e370fcda43082fb189b3ecf6

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

require File.dirname(__FILE__) + '/helper'

class TestCommitWrite < Test::Unit::TestCase
  def setup
    @r = Repo.new(GRIT_REPO)
  end

  def test_commit
    expect_commit
    results = @r.commit_index('my message')
    assert_commit(results)
  end

  def test_commit_with_author
    expect_commit
    results = @r.commit_index('my message','Phillip J Fry <fry@planex.info>')
    assert_commit(results)
  end

  def test_commit_with_actor
    expect_commit
    results = @r.commit_index('my message',Actor.new('Phillip J Fry','fry@planex.info'))
    assert_commit(results)
  end

  def test_commit_all
    expect_commit
    results = @r.commit_all('my message')
    assert_commit(results)
  end

  def test_commit_all_with_author
    expect_commit
    results = @r.commit_all('my message','Phillip J Fry <fry@planex.info>')
    assert_commit(results)
  end

  def test_commit_all_with_author
    expect_commit
    results = @r.commit_all('my message',Actor.new('Phillip J Fry','fry@planex.info'))
    assert_commit(results)
  end


  private

  def expect_commit
    Git.any_instance.expects(:commit).returns(fixture('commit'))
  end
  def assert_commit(results)
    assert_match /Created commit/, results
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
davetron5000-grit-1.1.2 test/test_commit_write.rb
davetron5000-grit-1.1.3 test/test_commit_write.rb