@@ -294,12 +294,7 @@ func TestRepoFork_outside_survey_yes(t *testing.T) {
294294 cs .Stub ("" ) // git clone
295295 cs .Stub ("" ) // git remote add
296296
297- oldConfirm := prompt .Confirm
298- prompt .Confirm = func (_ string , result * bool ) error {
299- * result = true
300- return nil
301- }
302- defer func () { prompt .Confirm = oldConfirm }()
297+ defer prompt .StubConfirm (true )()
303298
304299 output , err := RunCommand ("repo fork OWNER/REPO" )
305300 if err != nil {
@@ -329,12 +324,7 @@ func TestRepoFork_outside_survey_no(t *testing.T) {
329324 return & test.OutputStub {}
330325 })()
331326
332- oldConfirm := prompt .Confirm
333- prompt .Confirm = func (_ string , result * bool ) error {
334- * result = false
335- return nil
336- }
337- defer func () { prompt .Confirm = oldConfirm }()
327+ defer prompt .StubConfirm (false )()
338328
339329 output , err := RunCommand ("repo fork OWNER/REPO" )
340330 if err != nil {
@@ -367,12 +357,7 @@ func TestRepoFork_in_parent_survey_yes(t *testing.T) {
367357 return & test.OutputStub {}
368358 })()
369359
370- oldConfirm := prompt .Confirm
371- prompt .Confirm = func (_ string , result * bool ) error {
372- * result = true
373- return nil
374- }
375- defer func () { prompt .Confirm = oldConfirm }()
360+ defer prompt .StubConfirm (true )()
376361
377362 output , err := RunCommand ("repo fork" )
378363 if err != nil {
@@ -411,12 +396,7 @@ func TestRepoFork_in_parent_survey_no(t *testing.T) {
411396 return & test.OutputStub {}
412397 })()
413398
414- oldConfirm := prompt .Confirm
415- prompt .Confirm = func (_ string , result * bool ) error {
416- * result = false
417- return nil
418- }
419- defer func () { prompt .Confirm = oldConfirm }()
399+ defer prompt .StubConfirm (false )()
420400
421401 output , err := RunCommand ("repo fork" )
422402 if err != nil {
0 commit comments