Permalink
Browse files

Reviewr pushes the changes to master after they are merged

Signed-off-by: Ryan Burrows <rhburrows@gmail.com>
  • Loading branch information...
rhburrows committed Apr 28, 2010
1 parent 886bfeb commit 22b9cc7082291bcdeb94b0fe4e17c7bf072b7054
Showing with 31 additions and 10 deletions.
  1. +6 −0 features/reviewer_accepts_changes.feature
  2. +5 −2 lib/reviewr/cli/accept.rb
  3. +20 −8 spec/reviewr/cli/accept_spec.rb
@@ -24,3 +24,9 @@ Feature: Code Reviewer accepts changes
And branch "review_12345678" has commit "12345678123456781234567812345678" beyond master
When I run "reviewr accept review_12345678"
Then reviewr should cherry-pick commit "12345678123456781234567812345678"
Scenario: Reviewr pushes the merged branch to the remote repository
Given remote branch "review_12345678" will apply cleanly
And I am on branch "master"
When I run "reviewr accept review_12345678"
Then reviewr should push "master" to origin
@@ -9,11 +9,14 @@ def execute
project.fetch_review_branch
project.fetch_master
project.create_review_branch("origin/#{arguments.first}")
unless project.rebase_review
output.print "Branch '#{arguments.first}' won't merge cleanly"
else
project.change_branch(merge_branch)
project.merge_commits
project.push_branch(merge_branch)
end
project.change_branch(merge_branch)
project.merge_commits
end
end
end
@@ -45,15 +45,27 @@ module CLI
accept.call
end
it "changes back to the original git branch" do
project.stub(:current_branch).and_return('master')
project.should_receive(:change_branch).with('master')
accept.call
end
context "rebase is successful" do
before do
project.stub(:rebase_review).and_return(true)
end
it "merge in the extra commits from the review branch" do
project.should_receive(:merge_commits)
accept.call
it "changes back to the original git branch" do
project.stub(:current_branch).and_return('master')
project.should_receive(:change_branch).with('master')
accept.call
end
it "merges in the extra commits from the review branch" do
project.should_receive(:merge_commits)
accept.call
end
it "pushes the merged branch to the remote" do
project.stub(:current_branch).and_return('current')
project.should_receive(:push_branch).with("current")
accept.call
end
end
end
end

0 comments on commit 22b9cc7

Please sign in to comment.