func TestGetsRepoInfo(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) repo := git.NewGithubRepo("caarlos0/zsh-pg", home) assert.Equal(t, "caarlos0/zsh-pg", repo.Name()) assert.Equal(t, home+"caarlos0-zsh-pg", repo.Folder()) }
func TestUpdatesUnexistentRepo(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) repo := git.NewGithubRepo("doesn-not-exist-really", home) assert.Error(t, repo.Update()) internal.AssertFileCount(t, 0, home) }
func TestClonesRepo(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) repo := git.NewGithubRepo("caarlos0/env", home) assert.NoError(t, repo.Download()) internal.AssertFileCount(t, 1, home) }
func TestCloneDoesNothingIfFolderAlreadyExists(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) repo := git.NewGithubRepo("caarlos0/zsh-add-upstream", home) assert.NoError(t, repo.Download()) assert.NoError(t, repo.Download()) internal.AssertFileCount(t, 1, home) }
// New creates a new bundle instance func New(fullName, folder string) Bundle { return Bundle{git.NewGithubRepo(fullName, folder)} }