users can provide commitish
when creating a release
[finishes #99189274] Signed-off-by: Chris Walter <cwalter@pivotal.io>
This commit is contained in:
committed by
Chris Walter
parent
bd263fd89d
commit
3d99be0bca
@@ -100,20 +100,40 @@ var _ = Describe("Out Command", func() {
|
||||
}
|
||||
})
|
||||
|
||||
It("updates the existing release", func() {
|
||||
Ω(githubClient.UpdateReleaseCallCount()).Should(Equal(1))
|
||||
|
||||
updatedRelease := githubClient.UpdateReleaseArgsForCall(0)
|
||||
Ω(*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 a commitish is not supplied", func() {
|
||||
It("updates the existing release", func() {
|
||||
Ω(githubClient.UpdateReleaseCallCount()).Should(Equal(1))
|
||||
|
||||
updatedRelease := githubClient.UpdateReleaseArgsForCall(0)
|
||||
Ω(*updatedRelease.Name).Should(Equal("v0.3.12"))
|
||||
Ω(*updatedRelease.Body).Should(Equal("this is a great release"))
|
||||
Ω(updatedRelease.TargetCommitish).Should(Equal(github.String("")))
|
||||
})
|
||||
})
|
||||
|
||||
Context("when a commitish is supplied", func() {
|
||||
BeforeEach(func() {
|
||||
commitishPath := filepath.Join(sourcesDir, "commitish")
|
||||
file(commitishPath, "1z22f1")
|
||||
request.Params.CommitishPath = "commitish"
|
||||
})
|
||||
|
||||
It("updates the existing release", func() {
|
||||
Ω(githubClient.UpdateReleaseCallCount()).Should(Equal(1))
|
||||
|
||||
updatedRelease := githubClient.UpdateReleaseArgsForCall(0)
|
||||
Ω(*updatedRelease.Name).Should(Equal("v0.3.12"))
|
||||
Ω(*updatedRelease.Body).Should(Equal("this is a great release"))
|
||||
Ω(updatedRelease.TargetCommitish).Should(Equal(github.String("1z22f1")))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Context("when the release has not already been created", func() {
|
||||
@@ -132,6 +152,31 @@ var _ = Describe("Out Command", func() {
|
||||
}
|
||||
})
|
||||
|
||||
Context("with a commitish", func() {
|
||||
BeforeEach(func() {
|
||||
commitishPath := filepath.Join(sourcesDir, "commitish")
|
||||
file(commitishPath, "a2f4a3")
|
||||
request.Params.CommitishPath = "commitish"
|
||||
})
|
||||
|
||||
It("creates a release on GitHub with the commitish", func() {
|
||||
Ω(githubClient.CreateReleaseCallCount()).Should(Equal(1))
|
||||
release := githubClient.CreateReleaseArgsForCall(0)
|
||||
|
||||
Ω(release.TargetCommitish).Should(Equal(github.String("a2f4a3")))
|
||||
})
|
||||
})
|
||||
|
||||
Context("without a commitish", func() {
|
||||
It("creates a release on GitHub without the commitish", func() {
|
||||
Ω(githubClient.CreateReleaseCallCount()).Should(Equal(1))
|
||||
release := githubClient.CreateReleaseArgsForCall(0)
|
||||
|
||||
// GitHub treats empty string the same as not suppying the field.
|
||||
Ω(release.TargetCommitish).Should(Equal(github.String("")))
|
||||
})
|
||||
})
|
||||
|
||||
Context("with a body", func() {
|
||||
BeforeEach(func() {
|
||||
bodyPath := filepath.Join(sourcesDir, "body")
|
||||
|
Reference in New Issue
Block a user