github.com/segakazzz/buffalo@v0.16.22-0.20210119082501-1f52048d3feb/genny/vcs/vcs_test.go (about)

     1  package vcs
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  
     7  	"github.com/gobuffalo/genny/v2/gentest"
     8  	"github.com/stretchr/testify/require"
     9  )
    10  
    11  func Test_New(t *testing.T) {
    12  	r := require.New(t)
    13  
    14  	g, err := New(&Options{
    15  		Provider: "bzr",
    16  	})
    17  	r.NoError(err)
    18  
    19  	run := gentest.NewRunner()
    20  	run.With(g)
    21  
    22  	r.NoError(run.Run())
    23  
    24  	res := run.Results()
    25  
    26  	r.Len(res.Files, 1)
    27  
    28  	f := res.Files[0]
    29  	r.Equal(".bzrignore", f.Name())
    30  
    31  	cmds := []string{
    32  		"bzr init",
    33  		"bzr add . -q",
    34  		"bzr commit -q -m Initial Commit",
    35  	}
    36  
    37  	r.Len(res.Commands, len(cmds))
    38  	for i, c := range res.Commands {
    39  		r.Equal(cmds[i], strings.Join(c.Args, " "))
    40  	}
    41  }