Example #1
0
func TestSourceablesDotPluginZsh(t *testing.T) {
	home := doubles.TempHome()
	bundle := NewGitBundle("caarlos0/zsh-pg", home)
	bundle.Download()
	srcs := bundle.Sourceables()
	assert.Len(t, srcs, 1)
}
Example #2
0
func TestPullsRepo(t *testing.T) {
	home := doubles.TempHome()
	bundle := NewGitBundle("caarlos0/zsh-pg", home)
	bundle.Download()
	err := bundle.Update()
	assert.NoError(t, err)
}
Example #3
0
func TestSourceablesDotSh(t *testing.T) {
	home := doubles.TempHome()
	bundle := NewGitBundle("rupa/z", home)
	bundle.Download()
	srcs := bundle.Sourceables()
	assert.Len(t, srcs, 1)
}
Example #4
0
func TestClonesInvalidRepo(t *testing.T) {
	home := doubles.TempHome()
	err := NewGitBundle("this-doesnt-exist", home).Download()
	if err == nil {
		t.Error("Expected an error because this repo doesn't exist")
	}
}
Example #5
0
func TestFailsToBundleInvalidRepos(t *testing.T) {
	home := doubles.TempHome()
	// TODO return an error here
	// defer expectError(t)
	bundle("csadsadp", home)
	assertBundledPlugins(t, 0, home)
}
Example #6
0
func TestUpdatesBrokenRepo(t *testing.T) {
	home := doubles.TempHome()
	bundle := NewGitBundle("caarlos0/zsh-mkc", home)
	bundle.Download()
	os.RemoveAll(bundle.Folder() + "/.git")
	// TODO check amount of updated repos
	update(home)
}
Example #7
0
func TestPullsRepo(t *testing.T) {
	home := doubles.TempHome()
	bundle := NewGitBundle("caarlos0/zsh-pg", home)
	bundle.Download()
	err := bundle.Update()
	if err != nil {
		t.Error("No errors expected")
	}
}
Example #8
0
func TestSourceablesDotPluginZsh(t *testing.T) {
	home := doubles.TempHome()
	bundle := NewGitBundle("caarlos0/zsh-pg", home)
	bundle.Download()
	srcs := bundle.Sourceables()
	if len(srcs) != 1 {
		t.Error("Expected 1 sourceable file")
	}
}
Example #9
0
func TestSourceablesDotSh(t *testing.T) {
	home := doubles.TempHome()
	bundle := NewGitBundle("rupa/z", home)
	bundle.Download()
	srcs := bundle.Sourceables()
	if len(srcs) != 1 {
		t.Error("Expected 1 sourceable file")
	}
}
Example #10
0
func TestUpdatesListOfRepos(t *testing.T) {
	home := doubles.TempHome()
	bundle1 := "caarlos0/zsh-pg"
	bundle2 := "caarlos0/zsh-add-upstream"
	NewGitBundle(bundle1, home).Download()
	NewGitBundle(bundle2, home).Download()
	// TODO check amount of updated repos
	update(home)
}
Example #11
0
func TestClonesValidRepo(t *testing.T) {
	home := doubles.TempHome()
	bundle := NewGitBundle("caarlos0/zsh-pg", home)
	err := bundle.Download()
	expected := home + "caarlos0-zsh-pg"

	assert.Equal(t, expected, bundle.Folder())
	assert.NoError(t, err)
	assertBundledPlugins(t, 1, home)
}
Example #12
0
func TestClonesValidRepo(t *testing.T) {
	home := doubles.TempHome()
	bundle := NewGitBundle("caarlos0/zsh-pg", home)
	err := bundle.Download()
	expected := home + "caarlos0-zsh-pg"
	if bundle.Folder() != expected {
		t.Error("Got", bundle.Folder(), "expected", expected)
	}
	if err != nil {
		t.Error("No errors expected")
	}
	assertBundledPlugins(t, 1, home)
}
Example #13
0
func TestBundleWithNoBundles(t *testing.T) {
	home := doubles.TempHome()
	ProcessArgs([]string{"bundle", ""}, home, version)
	ProcessArgs([]string{"bundle"}, home, version)
	assertBundledPlugins(t, 0, home)
}
Example #14
0
func TestProcessStdinWithEmptyLines(t *testing.T) {
	home := doubles.TempHome()
	bundles := bytes.NewBufferString("\ncaarlos0/zsh-pg\ncaarlos0/zsh-add-upstream\n")
	ProcessStdin(bundles, home)
	assertBundledPlugins(t, 2, home)
}
Example #15
0
func TestProcessesArgsDoBundle(t *testing.T) {
	home := doubles.TempHome()
	ProcessArgs([]string{"bundle", "caarlos0/zsh-pg"}, home)
	assertBundledPlugins(t, 1, home)
}
Example #16
0
func TestUpdateWithNoPlugins(t *testing.T) {
	home := doubles.TempHome()
	ProcessArgs([]string{"update"}, home)
	assertBundledPlugins(t, 0, home)
}
Example #17
0
func TestClonesInvalidRepo(t *testing.T) {
	home := doubles.TempHome()
	err := NewGitBundle("this-doesnt-exist", home).Download()
	assert.Error(t, err)
}
Example #18
0
func TestBundleMkdirs(t *testing.T) {
	home := filepath.Join(doubles.TempHome(), "long/folder/which/dont/exist")
	bundle("caarlos0/zsh-pg", home)
	ProcessArgs([]string{"update"}, home)
	assertBundledPlugins(t, 1, home)
}
Example #19
0
func TestVersion(t *testing.T) {
	home := doubles.TempHome()
	ProcessArgs([]string{"version"}, home)
	assertBundledPlugins(t, 0, home)
}
Example #20
0
func TestUpdateWithPlugins(t *testing.T) {
	home := doubles.TempHome()
	bundle("caarlos0/zsh-pg", home)
	ProcessArgs([]string{"update"}, home)
	assertBundledPlugins(t, 1, home)
}
Example #21
0
func TestBundlesSinglePlugin(t *testing.T) {
	home := doubles.TempHome()
	bundle("caarlos0/zsh-pg", home)
	assertBundledPlugins(t, 1, home)
}
Example #22
0
func TestFailsToProcessInvalidArgs(t *testing.T) {
	home := doubles.TempHome()
	defer expectError(t)
	ProcessArgs([]string{"nope", "caarlos0/zsh-pg"}, home)
	assertBundledPlugins(t, 0, home)
}
Example #23
0
func TestLoadsCustomHome(t *testing.T) {
	home := doubles.TempHome()
	assert.Equal(t, home, Home())
}
Example #24
0
func TestLoadsCustomHome(t *testing.T) {
	home := doubles.TempHome()
	if home != Home() {
		t.Error("Expected custom ANTIBODY_HOME")
	}
}