Sha256: 7e84951484856dc7feb307651a255bc7f007a0b76db68ac2bb2c97ef4b8d294e
Contents?: true
Size: 1.17 KB
Versions: 6
Compression:
Stored size: 1.17 KB
Contents
require 'helper' describe Gitrb::Commit do REPO = '/tmp/gitrb_test' before do FileUtils.rm_rf REPO Dir.mkdir REPO @repo = Gitrb::Repository.new(:path => REPO, :create => true) end it "should dump in right format" do user = Gitrb::User.new("hanni", "hanni@email.de", Time.now) commit = Gitrb::Commit.new commit.tree = @repo.root commit.author = user commit.committer = user commit.message = "This is a message" content = commit.dump content.should.equal "tree #{@repo.root.id} author #{user.dump} committer #{user.dump} This is a message" end it "should be readable by git binary" do time = Time.local(2009, 4, 20) author = Gitrb::User.new("hans", "hans@email.de", time) repo.root['a'] = Gitrb::Blob.new(:data => "Yay") commit = repo.commit("Commit Message", author, author) IO.popen("git log") do |io| io.gets.should.equal "commit #{commit.id}\n" io.gets.should.equal "Author: hans <hans@email.de>\n" io.gets.should.equal "Date: Mon Apr 20 00:00:00 2009 #{Time.now.strftime('%z')}\n" io.gets.should.equal "\n" io.gets.should.equal " Commit Message\n" end end end
Version data entries
6 entries across 6 versions & 1 rubygems