require File.dirname(__FILE__) + '/spec_helper'
include Babygitter::HtmlOutput
describe Babygitter::HtmlOutput do
it "should list the authors of the repo in a readible manner" do
authors_list(GIT_REPO.authors_names).should == "Chris Wanstrath, Cristi Balan, Dustin Sallings, " +
"Kamal Fariz Mahyuddin, rick, Scott Chacon, Tim Carey-Smith, tom, Tom Preston-Werner and Wayne Larsen have"
end
it "should list the authors commits of the repo in a readible manner" do
committer_detail(GIT_REPO.branches.first.authors.first.commits[0..3], "").should ==
"
timeout code and tests Chris Wanstrath Mar 30 11:50 PM 2008 30e367c" +
"\nadd timeout protection to grit Chris Wanstrath Mar 30 07:31 PM 2008 5a09431" +
"\nsupport for heads with slashes in them Chris Wanstrath Mar 29 11:31 PM 2008 e1193f8" +
"\nTouch up Commit#to_hash\n\n* Use string instead of symbol keys\n* Return parents as 'id' => ID rather than array " +
"of id strings Chris Wanstrath Mar 10 09:10 PM 2008 ad44b88"
end
it "should display links to each author for branch" do
author_links(GIT_REPO.branches.first).should == ""
end
it "should display links to author correctly if there is only one for branch" do
GIT_REPO.branches.first.stub!(:author_names).and_return(['Matthew Bergman'])
author_links(GIT_REPO.branches.first).gsub(/\s+/, ' ').should == " " +
" - Only Matthew Bergman has committed to nonpack
"
end
it "should list the branch names in a readible manner" do
branch_names_list(GIT_REPO.branch_names).strip.should == "\n - \n "+
"nonpack\n
\n - \n test/master\n
\n - \n "+
"master\n
\n - \n test/chacon\n
\n
\n"
end
it "should output the branch synopsis in useable html" do
branch_synopsis(GIT_REPO.branches.first).gsub(/\s+/, ' ').should =="Last commit was ca8a30f by Scott Chacon on Apr 18 07:27 PM 2008
They have committed a total of 107 branches
nonpack is a stub with no unique commits
"
end
end