[git tests] Move prepareRemoteRepoAndBranch to GitLightTest.

This commit is contained in:
Kirill Likhodedov
2012-10-18 17:53:52 +04:00
parent bd5a68cf36
commit c87ad780cd
2 changed files with 17 additions and 20 deletions
@@ -525,8 +525,12 @@ class GitBranchWorkerTest extends GitLightTest {
@Test
public void "delete branch merged to head but unmerged to upstream should show dialog"() {
// inspired by IDEA-83604
// for the sake of simplicity we deal with a single myCommunity repository for remote operations
prepareRemoteRepoAndBranch(myCommunity)
cd myCommunity
git("checkout -b feature");
git("push -u origin feature")
prepareRemoteRepoAndBranch("feature")
// create a commit and merge it to master, but not to feature's upstream
touch("feature.txt", "feature content")
git("add feature.txt")
@@ -544,25 +548,6 @@ class GitBranchWorkerTest extends GitLightTest {
assertTrue "'Branch is not fully merged' dialog was not shown", dialogShown
}
// for the sake of simplicity we deal with a single myCommunity repository for remote operations
private void prepareRemoteRepoAndBranch(String branch) {
// prepare parent repository
// create it under ultimate not to bother with removing it after the test (tearDown will clean automatically)
cd myUltimate
git("clone --bare $myCommunity parent.git")
// initialize feature branch and push to make origin/feature, set up tracking
cd myCommunity
git("checkout -b $branch");
git("remote add origin ${myUltimate.root.path}/parent.git");
git("push -u origin $branch")
}
@Test
void "delete remote branch without problems"() {
}
@Test
public void "simple merge without problems"() {
branchWithCommit(myRepositories, "master2", "branch_file.txt", "branch content")
@@ -93,6 +93,18 @@ class GitLightTest {
return repository
}
/**
* Clones the given source repository into a bare parent.git and adds the remote origin.
*/
protected void prepareRemoteRepoAndBranch(GitRepository source) {
cd myTestRoot
git("clone --bare $source parent.git")
// initialize feature branch and push to make origin/feature, set up tracking
cd source
git("remote add origin ${myTestRoot}/parent.git");
}
private void registerRepository(GitRepositoryImpl repository) {
((GitTestRepositoryManager)myPlatformFacade.getRepositoryManager(myProject)).add(repository)
}