Skip to content

Commit

Permalink
More test stabilization against git2 temp file
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Jul 23, 2020
1 parent bab3051 commit 0a6303e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/NerdBank.GitVersioning.Tests/ReleaseManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ public void PrepareRelease_MasterWithVersionDecrement(string initialVersion, str
public void PrepareRelease_DetachedHead()
{
this.InitializeSourceControl();
this.Ignore_git2_UntrackedFile();
this.WriteVersionFile("1.0", "-alpha");
Commands.Checkout(this.Repo, this.Repo.Head.Commits.First());
var ex = Assert.Throws<ReleasePreparationException>(() => new ReleaseManager().PrepareRelease(this.RepoPath));
Expand Down Expand Up @@ -553,6 +552,12 @@ public void PrepareRelease_JsonOutputWhenUpdatingReleaseBranch()
}
}

protected override void InitializeSourceControl()
{
base.InitializeSourceControl();
this.Ignore_git2_UntrackedFile();
}

private void AssertError(Action testCode, ReleasePreparationError expectedError)
{
var ex = Assert.Throws<ReleasePreparationException>(testCode);
Expand Down
2 changes: 1 addition & 1 deletion src/NerdBank.GitVersioning.Tests/RepoTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected virtual void Dispose(bool disposing)
}
}

protected void InitializeSourceControl()
protected virtual void InitializeSourceControl()
{
Repository.Init(this.RepoPath);
this.Repo = new Repository(this.RepoPath);
Expand Down

0 comments on commit 0a6303e

Please sign in to comment.