Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Add nominal new app integration test #1219

Merged
merged 2 commits into from
Aug 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions buffalo/cmd/new_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ package cmd

import (
"fmt"
"io/ioutil"
"os"
"path"
"strings"
"testing"

"github.com/gobuffalo/envy"
"github.com/gobuffalo/pop"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -49,3 +53,35 @@ func Test_NewCmd_ForbiddenAppName(t *testing.T) {
err := c.Execute()
r.EqualError(err, "name buffalo is not allowed, try a different application name")
}

func Test_NewCmd_Nominal(t *testing.T) {
r := require.New(t)
c := RootCmd

tdir, err := ioutil.TempDir("", "gopath")
r.NoError(err)
defer os.RemoveAll(tdir)
gp, err := envy.MustGet("GOPATH")
r.NoError(err)
defer envy.MustSet("GOPATH", gp)
err = envy.MustSet("GOPATH", tdir)
r.NoError(err)

cpath := path.Join(tdir, "src", "github.com", "gobuffalo")
err = os.MkdirAll(cpath, 0700)
r.NoError(err)
pwd, err := os.Getwd()
r.NoError(err)
os.Chdir(cpath)
defer os.Chdir(pwd)

c.SetArgs([]string{
"new",
"hello_world",
"--skip-pop",
"--skip-webpack",
"--vcs=none",
})
err = c.Execute()
r.NoError(err)
}