Permalink
Browse files

Accidentally broke request by not checking out the review branch

In request it creates a branch for code review and adds a commit to
it. By not checking it out after creating it the commit was added to
whatever branch the review request was issued from. This also resulted
in the wrong code being pushed for review

Signed-off-by: Ryan Burrows <rhburrows@gmail.com>
  • Loading branch information...
rhburrows committed Apr 28, 2010
1 parent b8605a6 commit cb859b479555fa1ac192fd853f2c34ce5eda388d
Showing with 12 additions and 0 deletions.
  1. +1 −0 lib/reviewr/project.rb
  2. +11 −0 spec/reviewr/project_spec.rb
View
@@ -17,6 +17,7 @@ def initialize(git = Git.instance)
def create_review_branch(base = 'master')
git.create_branch(review_branch, base)
+ git.change_branch(review_branch)
end
def rebase_review
@@ -58,6 +58,11 @@ module Reviewr
end
describe "#create_review_branch" do
+ before do
+ git.stub(:create_branch)
+ git.stub(:change_branch)
+ end
+
it "creates the branch with the name from #review_branch" do
project.stub(:review_branch).and_return('branch')
git.should_receive(:create_branch).with('branch', anything)
@@ -75,6 +80,12 @@ module Reviewr
git.should_receive(:create_branch).with(anything, 'master')
project.create_review_branch
end
+
+ it "checks out the new branch" do
+ project.stub(:review_branch).and_return("review")
+ git.should_receive(:change_branch).with("review")
+ project.create_review_branch
+ end
end
describe "#push_review_branch" do

0 comments on commit cb859b4

Please sign in to comment.