aboutsummaryrefslogtreecommitdiff
path: root/pkg/rtree/get_test.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2017-07-07 12:24:09 +0200
committerStefan Majewsky <majewsky@gmx.net>2017-07-07 12:24:09 +0200
commit9365e7673bfb490edbad02dfbf449d3da5deed98 (patch)
treee59d035aa7bd607ce34778440a5dec71af00f7db /pkg/rtree/get_test.go
parent23077b75410d6fab51762236f195d92bd559fc6a (diff)
downloadgofu-9365e7673bfb490edbad02dfbf449d3da5deed98.tar.gz
more compact specification of recorded commands
Diffstat (limited to 'pkg/rtree/get_test.go')
-rw-r--r--pkg/rtree/get_test.go34
1 files changed, 9 insertions, 25 deletions
diff --git a/pkg/rtree/get_test.go b/pkg/rtree/get_test.go
index 8ab21f1..bdd0f2e 100644
--- a/pkg/rtree/get_test.go
+++ b/pkg/rtree/get_test.go
@@ -22,8 +22,6 @@ import (
"fmt"
"path/filepath"
"testing"
-
- "github.com/majewsky/gofu/pkg/cli"
)
var testIndexWithTwoRepos = Index{
@@ -63,14 +61,10 @@ func TestGetNewRepo(t *testing.T) {
target := filepath.Join(RootPath, "/github.com/another/repo")
Test{
- Args: []string{"get", "gh:another/repo"},
- Index: testIndexWithTwoRepos,
- ExpectOutput: target + "\n",
- ExpectExecution: []RecordedCommand{
- {Cmd: cli.Command{
- Program: []string{"git", "clone", "gh:another/repo", target},
- }},
- },
+ Args: []string{"get", "gh:another/repo"},
+ Index: testIndexWithTwoRepos,
+ ExpectOutput: target + "\n",
+ ExpectExecution: Recorded("git clone gh:another/repo " + target),
ExpectIndex: &Index{
Repos: []*Repo{
{
@@ -99,16 +93,10 @@ func TestGetNewForkAsRemote(t *testing.T) {
"Enter remote name for https://example.com/git: myfork\n",
target,
),
- ExpectExecution: []RecordedCommand{
- {Cmd: cli.Command{
- Program: []string{"git", "remote", "add", "myfork", "https://example.com/git"},
- WorkDir: target,
- }},
- {Cmd: cli.Command{
- Program: []string{"git", "remote", "update", "myfork"},
- WorkDir: target,
- }},
- },
+ ExpectExecution: Recorded(
+ "@"+target+" git remote add myfork https://example.com/git",
+ "@"+target+" git remote update myfork",
+ ),
ExpectIndex: &Index{
Repos: []*Repo{
testIndexWithTwoRepos.Repos[0],
@@ -135,11 +123,7 @@ func TestGetNewForkAsSeparate(t *testing.T) {
"Found possible fork candidates. What to do? -> clone to %s\n",
target,
),
- ExpectExecution: []RecordedCommand{
- {Cmd: cli.Command{
- Program: []string{"git", "clone", "https://example.com/git", target},
- }},
- },
+ ExpectExecution: Recorded("git clone https://example.com/git " + target),
ExpectIndex: &Index{
Repos: []*Repo{
{