From e3950d52c1edca9815b51567dba95499b17be797 Mon Sep 17 00:00:00 2001 From: Randy Merrill Date: Thu, 27 Jan 2011 13:59:39 -0800 Subject: [PATCH] Removing the `ref` as an argument to the `Committer#parents` and just using the `@wiki.ref`. Updated the test to reflect the change and to test creating a wiki with a custom ref returns the correct parent for the `Committer#parents`. --- lib/gollum/committer.rb | 4 ++-- test/test_committer.rb | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/gollum/committer.rb b/lib/gollum/committer.rb index 3f7df6d6..68161f83 100644 --- a/lib/gollum/committer.rb +++ b/lib/gollum/committer.rb @@ -60,9 +60,9 @@ module Gollum # Public: The parent commits to this pending commit. # # Returns an array of Grit::Commit instances. - def parents(ref = @wiki.ref) + def parents() @parents ||= begin - arr = [@options[:parent] || @wiki.repo.commit(ref)] + arr = [@options[:parent] || @wiki.repo.commit(@wiki.ref)] arr.flatten! arr.compact! arr diff --git a/test/test_committer.rb b/test/test_committer.rb index bbfc4617..45842a01 100644 --- a/test/test_committer.rb +++ b/test/test_committer.rb @@ -48,7 +48,7 @@ context "Wiki" do end end - test "parents with default wiki ref" do + test "parents with default master ref" do ref = 'a8ad3c09dd842a3517085bfadd37718856dee813' committer = Gollum::Committer.new(@wiki) assert_equal ref, committer.parents.first.sha @@ -56,7 +56,8 @@ context "Wiki" do test "parents with custom ref" do ref = '60f12f4254f58801b9ee7db7bca5fa8aeefaa56b' + @wiki = Gollum::Wiki.new(testpath("examples/lotr.git"), :ref => ref) committer = Gollum::Committer.new(@wiki) - assert_equal ref, committer.parents(ref).first.sha + assert_equal ref, committer.parents.first.sha end end \ No newline at end of file