test/test_commit.rb in mojombo-grit-0.8.1 vs test/test_commit.rb in mojombo-grit-0.9.3

- old
+ new

@@ -1,10 +1,10 @@ require File.dirname(__FILE__) + '/helper' class TestCommit < Test::Unit::TestCase def setup - @r = Repo.new(GRIT_REPO) + @r = Repo.new(File.join(File.dirname(__FILE__), *%w[dot_git]), :is_bare => true) end # __bake__ def test_bake @@ -17,11 +17,10 @@ end # short_name def test_id_abbrev - Git.any_instance.expects(:rev_parse).returns(fixture('rev_parse')) assert_equal '80f136f', @r.commit('80f136f500dfdb8c3e8abf4ae716f875f0a1b57f').id_abbrev end # diff @@ -162,21 +161,24 @@ end # to_hash def test_to_hash + old_tz, ENV["TZ"] = ENV["TZ"], "US/Pacific" @c = Commit.create(@r, :id => '4c8124ffcf4039d292442eeccabdeca5af5c5017') - + date = Time.parse('Wed Oct 10 03:06:12 -0400 2007') expected = { 'parents' => ['id' => "634396b2f541a9f2d58b00be1a07f0c358b999b3"], - 'committed_date' => "2007-10-10T00:06:12-07:00", + 'committed_date' => date.xmlschema, 'tree' => "672eca9b7f9e09c22dcb128c283e8c3c8d7697a4", - 'authored_date' => "2007-10-10T00:06:12-07:00", + 'authored_date' => date.xmlschema, 'committer' => {'email' => "tom@mojombo.com", 'name' => "Tom Preston-Werner"}, 'message' => "implement Grit#heads", 'author' => {'email' => "tom@mojombo.com", 'name' => "Tom Preston-Werner"}, 'id' => "4c8124ffcf4039d292442eeccabdeca5af5c5017" } assert_equal expected, @c.to_hash + ensure + ENV["TZ"] = old_tz end end