@@ -217,6 +217,24 @@ var _ = Describe("Out Command", func() {
217217 Ω (updatedRelease .TargetCommitish ).Should (Equal (github .String ("1z22f1" )))
218218 })
219219 })
220+
221+ Context ("when set to autogenerate release notes" , func () {
222+ BeforeEach (func () {
223+ request .Params .GenerateReleaseNotes = true
224+ })
225+ // See https://github.com/google/go-github/issues/2444
226+ It ("has no effect on updating the existing release" , func () {
227+ _ , err := command .Run (sourcesDir , request )
228+ Ω (err ).ShouldNot (HaveOccurred ())
229+
230+ Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (1 ))
231+
232+ updatedRelease := githubClient .UpdateReleaseArgsForCall (0 )
233+ Ω (* updatedRelease .Name ).Should (Equal ("v0.3.12" ))
234+ Ω (* updatedRelease .Body ).Should (Equal ("this is a great release" ))
235+ Ω (updatedRelease .GenerateReleaseNotes ).Should (BeNil ())
236+ })
237+ })
220238 })
221239
222240 Context ("when the release has not already been created" , func () {
@@ -585,5 +603,37 @@ var _ = Describe("Out Command", func() {
585603 Ω (* release .TagName ).Should (Equal ("version-0.3.12" ))
586604 })
587605 })
606+
607+ Context ("with generate_release_notes set to false" , func () {
608+ BeforeEach (func () {
609+ request .Params .GenerateReleaseNotes = false
610+ })
611+
612+ It ("creates a release on GitHub without autogenerated release notes" , func () {
613+ _ , err := command .Run (sourcesDir , request )
614+ Ω (err ).ShouldNot (HaveOccurred ())
615+
616+ Ω (githubClient .CreateReleaseCallCount ()).Should (Equal (1 ))
617+ release := githubClient .CreateReleaseArgsForCall (0 )
618+
619+ Ω (release .GenerateReleaseNotes ).Should (Equal (github .Bool (false )))
620+ })
621+ })
622+
623+ Context ("with generate_release_notes set to true" , func () {
624+ BeforeEach (func () {
625+ request .Params .GenerateReleaseNotes = true
626+ })
627+
628+ It ("creates a release on GitHub with autogenerated release notes" , func () {
629+ _ , err := command .Run (sourcesDir , request )
630+ Ω (err ).ShouldNot (HaveOccurred ())
631+
632+ Ω (githubClient .CreateReleaseCallCount ()).Should (Equal (1 ))
633+ release := githubClient .CreateReleaseArgsForCall (0 )
634+
635+ Ω (release .GenerateReleaseNotes ).Should (Equal (github .Bool (true )))
636+ })
637+ })
588638 })
589639})
0 commit comments