Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

stub git call for Grit#heads test

  • Loading branch information...
commit 06f63b43050935962f84fe54473a7c5de7977325 1 parent 4c8124f
@mojombo authored
Showing with 7 additions and 1 deletion.
  1. +1 −1  lib/grit/grit.rb
  2. +2 −0  test/helper.rb
  3. +4 −0 test/test_grit.rb
View
2  lib/grit/grit.rb
@@ -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")
View
2  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[..])
View
4 test/test_grit.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.