Skip to content

Commit 89de756

Browse files
committed
[test_helper.rb] Add TestRepo#checkout_b
A instance method helper for TestRepo which performs a checkout out of a new branch based off another (or the current branch if no second arg is passed). Mirrors the usage of `git checkout -b [new_branch] [base_branch]`
1 parent 6b22524 commit 89de756

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/test_helper.rb

+6
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,12 @@ def checkout branch
223223
repo.checkout branch
224224
end
225225

226+
def checkout_b branch, source = nil
227+
repo.create_branch(*[branch, source].compact)
228+
repo.checkout branch
229+
@last_commit = repo.last_commit
230+
end
231+
226232
# Commit with all changes added to the index
227233
#
228234
# $ git add . && git commit -am "${msg}"

0 commit comments

Comments
 (0)