clear out any existing release assets

[#76848252]

Signed-off-by: Chris Brown <cbrown@pivotal.io>
This commit is contained in:
Alex Suraci
2015-02-20 11:06:13 -08:00
committed by Chris Brown
parent 125bd204e4
commit 330d632d62
4 changed files with 103 additions and 7 deletions

View File

@@ -63,9 +63,18 @@ var _ = Describe("Out Command", func() {
})
Context("when the release has already been created", func() {
existingAssets := []github.ReleaseAsset{
{ID: github.Int(456789)},
{ID: github.Int(3450798)},
}
BeforeEach(func() {
githubClient.ListReleasesReturns([]github.RepositoryRelease{
{ID: github.Int(112), TagName: github.String("some-tag-name")},
{
ID: github.Int(112),
TagName: github.String("some-tag-name"),
Assets: existingAssets,
},
}, nil)
namePath := filepath.Join(sourcesDir, "name")
@@ -92,6 +101,13 @@ var _ = Describe("Out Command", func() {
Ω(*updatedRelease.Name).Should(Equal("v0.3.12"))
Ω(*updatedRelease.Body).Should(Equal("this is a great release"))
})
It("deletes the existing assets", func() {
Ω(githubClient.DeleteReleaseAssetCallCount()).Should(Equal(2))
Ω(githubClient.DeleteReleaseAssetArgsForCall(0)).Should(Equal(existingAssets[0]))
Ω(githubClient.DeleteReleaseAssetArgsForCall(1)).Should(Equal(existingAssets[1]))
})
})
Context("when the release has not already been created", func() {