@@ -33,7 +33,7 @@ var _ = Describe("Out Command", func() {
3333 var err error
3434
3535 githubClient = & fakes.FakeGitHub {}
36- command = resource .NewOutCommand (githubClient , io . Discard )
36+ command = resource .NewOutCommand (githubClient , os . Stderr )
3737
3838 sourcesDir , err = os .MkdirTemp ("" , "github-release" )
3939 Ω (err ).ShouldNot (HaveOccurred ())
@@ -42,8 +42,9 @@ var _ = Describe("Out Command", func() {
4242 createdRel := gh
4343 createdRel .ID = github .Int64 (112 )
4444 createdRel .HTMLURL = github .String ("http://google.com" )
45- createdRel .Name = github .String ("release-name" )
46- createdRel .Body = github .String ("*markdown*" )
45+ createdRel .Name = gh .Name
46+ createdRel .Body = gh .Body
47+ createdRel .TagName = gh .TagName
4748 return & createdRel , nil
4849 }
4950
@@ -142,7 +143,7 @@ var _ = Describe("Out Command", func() {
142143 _ , err := command .Run (sourcesDir , request )
143144 Ω (err ).ShouldNot (HaveOccurred ())
144145
145- Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (1 ))
146+ Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (2 ))
146147
147148 updatedRelease := githubClient .UpdateReleaseArgsForCall (0 )
148149 Ω (* updatedRelease .Name ).Should (Equal ("v0.3.12" ))
@@ -159,9 +160,9 @@ var _ = Describe("Out Command", func() {
159160 _ , err := command .Run (sourcesDir , request )
160161 Ω (err ).ShouldNot (HaveOccurred ())
161162
162- Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (1 ))
163+ Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (2 ))
163164
164- updatedRelease := githubClient .UpdateReleaseArgsForCall (0 )
165+ updatedRelease := githubClient .UpdateReleaseArgsForCall (1 )
165166 Ω (* updatedRelease .Name ).Should (Equal ("v0.3.12" ))
166167 Ω (* updatedRelease .Draft ).Should (Equal (true ))
167168 })
@@ -176,7 +177,7 @@ var _ = Describe("Out Command", func() {
176177 _ , err := command .Run (sourcesDir , request )
177178 Ω (err ).ShouldNot (HaveOccurred ())
178179
179- Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (1 ))
180+ Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (2 ))
180181
181182 updatedRelease := githubClient .UpdateReleaseArgsForCall (0 )
182183 Ω (* updatedRelease .Name ).Should (Equal ("v0.3.12" ))
@@ -189,7 +190,7 @@ var _ = Describe("Out Command", func() {
189190 _ , err := command .Run (sourcesDir , request )
190191 Ω (err ).ShouldNot (HaveOccurred ())
191192
192- Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (1 ))
193+ Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (2 ))
193194
194195 updatedRelease := githubClient .UpdateReleaseArgsForCall (0 )
195196 Ω (* updatedRelease .Name ).Should (Equal ("v0.3.12" ))
@@ -209,7 +210,7 @@ var _ = Describe("Out Command", func() {
209210 _ , err := command .Run (sourcesDir , request )
210211 Ω (err ).ShouldNot (HaveOccurred ())
211212
212- Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (1 ))
213+ Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (2 ))
213214
214215 updatedRelease := githubClient .UpdateReleaseArgsForCall (0 )
215216 Ω (* updatedRelease .Name ).Should (Equal ("v0.3.12" ))
@@ -227,7 +228,7 @@ var _ = Describe("Out Command", func() {
227228 _ , err := command .Run (sourcesDir , request )
228229 Ω (err ).ShouldNot (HaveOccurred ())
229230
230- Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (1 ))
231+ Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (2 ))
231232
232233 updatedRelease := githubClient .UpdateReleaseArgsForCall (0 )
233234 Ω (* updatedRelease .Name ).Should (Equal ("v0.3.12" ))
@@ -323,15 +324,20 @@ var _ = Describe("Out Command", func() {
323324 Ω (err ).ShouldNot (HaveOccurred ())
324325
325326 Ω (githubClient .CreateReleaseCallCount ()).Should (Equal (1 ))
327+ Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (1 ))
328+
326329 release := githubClient .CreateReleaseArgsForCall (0 )
330+ Ω (* release .Draft ).Should (Equal (true ))
327331
332+ release = githubClient .UpdateReleaseArgsForCall (0 )
328333 Ω (* release .Draft ).Should (Equal (false ))
329334 })
330335
331336 Context ("when pre-release are set and release are not" , func () {
332337 BeforeEach (func () {
333338 bodyPath := filepath .Join (sourcesDir , "body" )
334339 file (bodyPath , "this is a great release" )
340+ request .Params .BodyPath = "body"
335341 request .Source .Release = false
336342 request .Source .PreRelease = true
337343 })
@@ -341,11 +347,20 @@ var _ = Describe("Out Command", func() {
341347 Ω (err ).ShouldNot (HaveOccurred ())
342348
343349 Ω (githubClient .CreateReleaseCallCount ()).Should (Equal (1 ))
350+ Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (1 ))
344351 release := githubClient .CreateReleaseArgsForCall (0 )
345352
346353 Ω (* release .Name ).Should (Equal ("v0.3.12" ))
347354 Ω (* release .TagName ).Should (Equal ("0.3.12" ))
348- Ω (* release .Body ).Should (Equal ("" ))
355+ Ω (* release .Body ).Should (Equal ("this is a great release" ))
356+ Ω (* release .Draft ).Should (Equal (true ))
357+ Ω (* release .Prerelease ).Should (Equal (true ))
358+
359+ release = githubClient .UpdateReleaseArgsForCall (0 )
360+
361+ Ω (* release .Name ).Should (Equal ("v0.3.12" ))
362+ Ω (* release .TagName ).Should (Equal ("0.3.12" ))
363+ Ω (* release .Body ).Should (Equal ("this is a great release" ))
349364 Ω (* release .Draft ).Should (Equal (false ))
350365 Ω (* release .Prerelease ).Should (Equal (true ))
351366 })
@@ -356,8 +371,8 @@ var _ = Describe("Out Command", func() {
356371
357372 Ω (outResponse .Metadata ).Should (ConsistOf (
358373 resource.MetadataPair {Name : "url" , Value : "http://google.com" },
359- resource.MetadataPair {Name : "name" , Value : "release-name " , URL : "http://google.com" },
360- resource.MetadataPair {Name : "body" , Value : "*markdown* " , Markdown : true },
374+ resource.MetadataPair {Name : "name" , Value : "v0.3.12 " , URL : "http://google.com" },
375+ resource.MetadataPair {Name : "body" , Value : "this is a great release " , Markdown : true },
361376 resource.MetadataPair {Name : "tag" , Value : "0.3.12" },
362377 resource.MetadataPair {Name : "pre-release" , Value : "true" },
363378 ))
@@ -368,6 +383,7 @@ var _ = Describe("Out Command", func() {
368383 BeforeEach (func () {
369384 bodyPath := filepath .Join (sourcesDir , "body" )
370385 file (bodyPath , "this is a great release" )
386+ request .Params .BodyPath = "body"
371387 request .Source .Release = true
372388 request .Source .PreRelease = true
373389 })
@@ -377,11 +393,20 @@ var _ = Describe("Out Command", func() {
377393 Ω (err ).ShouldNot (HaveOccurred ())
378394
379395 Ω (githubClient .CreateReleaseCallCount ()).Should (Equal (1 ))
396+ Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (1 ))
380397 release := githubClient .CreateReleaseArgsForCall (0 )
381398
382399 Ω (* release .Name ).Should (Equal ("v0.3.12" ))
383400 Ω (* release .TagName ).Should (Equal ("0.3.12" ))
384- Ω (* release .Body ).Should (Equal ("" ))
401+ Ω (* release .Body ).Should (Equal ("this is a great release" ))
402+ Ω (* release .Draft ).Should (Equal (true ))
403+ Ω (* release .Prerelease ).Should (Equal (false ))
404+
405+ release = githubClient .UpdateReleaseArgsForCall (0 )
406+
407+ Ω (* release .Name ).Should (Equal ("v0.3.12" ))
408+ Ω (* release .TagName ).Should (Equal ("0.3.12" ))
409+ Ω (* release .Body ).Should (Equal ("this is a great release" ))
385410 Ω (* release .Draft ).Should (Equal (false ))
386411 Ω (* release .Prerelease ).Should (Equal (false ))
387412 })
@@ -392,8 +417,8 @@ var _ = Describe("Out Command", func() {
392417
393418 Ω (outResponse .Metadata ).Should (ConsistOf (
394419 resource.MetadataPair {Name : "url" , Value : "http://google.com" },
395- resource.MetadataPair {Name : "name" , Value : "release-name " , URL : "http://google.com" },
396- resource.MetadataPair {Name : "body" , Value : "*markdown* " , Markdown : true },
420+ resource.MetadataPair {Name : "name" , Value : "v0.3.12 " , URL : "http://google.com" },
421+ resource.MetadataPair {Name : "body" , Value : "this is a great release " , Markdown : true },
397422 resource.MetadataPair {Name : "tag" , Value : "0.3.12" },
398423 ))
399424 })
@@ -403,6 +428,7 @@ var _ = Describe("Out Command", func() {
403428 BeforeEach (func () {
404429 bodyPath := filepath .Join (sourcesDir , "body" )
405430 file (bodyPath , "this is a great release" )
431+ request .Params .BodyPath = "body"
406432 request .Source .Drafts = true
407433 })
408434
@@ -411,11 +437,20 @@ var _ = Describe("Out Command", func() {
411437 Ω (err ).ShouldNot (HaveOccurred ())
412438
413439 Ω (githubClient .CreateReleaseCallCount ()).Should (Equal (1 ))
440+ Ω (githubClient .UpdateReleaseCallCount ()).Should (Equal (1 ))
414441 release := githubClient .CreateReleaseArgsForCall (0 )
415442
416443 Ω (* release .Name ).Should (Equal ("v0.3.12" ))
417444 Ω (* release .TagName ).Should (Equal ("0.3.12" ))
418- Ω (* release .Body ).Should (Equal ("" ))
445+ Ω (* release .Body ).Should (Equal ("this is a great release" ))
446+ Ω (* release .Draft ).Should (Equal (true ))
447+ Ω (* release .Prerelease ).Should (Equal (false ))
448+
449+ release = githubClient .UpdateReleaseArgsForCall (0 )
450+
451+ Ω (* release .Name ).Should (Equal ("v0.3.12" ))
452+ Ω (* release .TagName ).Should (Equal ("0.3.12" ))
453+ Ω (* release .Body ).Should (Equal ("this is a great release" ))
419454 Ω (* release .Draft ).Should (Equal (true ))
420455 Ω (* release .Prerelease ).Should (Equal (false ))
421456 })
@@ -426,8 +461,8 @@ var _ = Describe("Out Command", func() {
426461
427462 Ω (outResponse .Metadata ).Should (ConsistOf (
428463 resource.MetadataPair {Name : "url" , Value : "http://google.com" },
429- resource.MetadataPair {Name : "name" , Value : "release-name " , URL : "http://google.com" },
430- resource.MetadataPair {Name : "body" , Value : "*markdown* " , Markdown : true },
464+ resource.MetadataPair {Name : "name" , Value : "v0.3.12 " , URL : "http://google.com" },
465+ resource.MetadataPair {Name : "body" , Value : "this is a great release " , Markdown : true },
431466 resource.MetadataPair {Name : "tag" , Value : "0.3.12" },
432467 resource.MetadataPair {Name : "draft" , Value : "true" },
433468 ))
@@ -477,7 +512,7 @@ var _ = Describe("Out Command", func() {
477512
478513 Ω (outResponse .Metadata ).Should (ConsistOf (
479514 resource.MetadataPair {Name : "url" , Value : "http://google.com" },
480- resource.MetadataPair {Name : "name" , Value : "release-name " , URL : "http://google.com" },
515+ resource.MetadataPair {Name : "name" , Value : "v0.3.12 " , URL : "http://google.com" },
481516 resource.MetadataPair {Name : "body" , Value : "*markdown*" , Markdown : true },
482517 resource.MetadataPair {Name : "tag" , Value : "0.3.12" },
483518 ))
0 commit comments