Skip to content

Commit

Permalink
stub git call for Grit#heads test
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed Oct 10, 2007
1 parent 4c8124f commit 06f63b4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/grit/grit.rb
Expand Up @@ -34,7 +34,7 @@ def description
# Returns Grit::Head[]
def heads
output = git("for-each-ref",
"--count=1",
# "--count=1",
"--sort=-committerdate",
"--format='%(objectname) %(refname) %(subject)%00%(committer)'",
"refs/heads")
Expand Down
2 changes: 2 additions & 0 deletions test/helper.rb
@@ -1,5 +1,7 @@
require File.join(File.dirname(__FILE__), *%w[.. lib grit])

require 'rubygems'
require 'test/unit'
require 'mocha'

GRIT_REPO = File.join(File.dirname(__FILE__), *%w[..])
4 changes: 4 additions & 0 deletions test/test_grit.rb
Expand Up @@ -10,9 +10,13 @@ def test_description
end

def test_heads
@g.expects(:git).returns("634396b2f541a9f2d58b00be1a07f0c358b999b3 refs/heads/master \
initial grit setup\0Tom Preston-Werner <tom@mojombo.com> 1191997100 -0700")

heads = @g.heads
head = heads.first
assert_equal Grit::Head, head.class

assert_equal '634396b2f541a9f2d58b00be1a07f0c358b999b3', head.id
assert_equal 'refs/heads/master', head.name
assert_equal 'initial grit setup', head.message
Expand Down

0 comments on commit 06f63b4

Please sign in to comment.