Sha256: 6a183278a7ec8c50c8782db63b90b3a7cbe30c33c7336c28ecfdeef0c44dcc12

Contents?: true

Size: 1.09 KB

Versions: 11

Compression:

Stored size: 1.09 KB

Contents

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

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

  def test_add
    Git.any_instance.expects(:add).with({}, 'file1', 'file2')
    @r.add('file1', 'file2')
  end

  def test_add_array
    Git.any_instance.expects(:add).with({}, 'file1', 'file2')
    @r.add(['file1', 'file2'])
  end
  
  def test_remove
    Git.any_instance.expects(:rm).with({}, 'file1', 'file2')
    @r.remove('file1', 'file2')
  end

  def test_remove_array
    Git.any_instance.expects(:rm).with({}, 'file1', 'file2')
    @r.remove(['file1', 'file2'])
  end

  def test_status
    Git.any_instance.expects(:diff_index).with({}, 'HEAD').returns(fixture('diff_index'))
    Git.any_instance.expects(:diff_files).returns(fixture('diff_files'))
    Git.any_instance.expects(:ls_files).with({:stage => true}).returns(fixture('ls_files'))
    status = @r.status
    stat = status['lib/grit/repo.rb']
    assert_equal stat.sha_repo, "71e930d551c413a123f43e35c632ea6ba3e3705e"
    assert_equal stat.mode_repo, "100644"
    assert_equal stat.type, "M"
  end
  
  
end

Version data entries

11 entries across 11 versions & 5 rubygems

Version Path
boof-grit-1.1.2 test/test_index_status.rb
davetron5000-grit-1.1.2 test/test_index_status.rb
davetron5000-grit-1.1.3 test/test_index_status.rb
joelmoss-grit-1.1.4 test/test_index_status.rb
joelmoss-grit-1.1.5 test/test_index_status.rb
joelmoss-grit-1.1.6 test/test_index_status.rb
square-circle-triangle-grit-1.1.3 test/test_index_status.rb
square-circle-triangle-grit-1.1.4 test/test_index_status.rb
grit-1.0.0 test/test_index_status.rb
grit-1.1.0 test/test_index_status.rb
grit-1.0.1 test/test_index_status.rb