-
-
Notifications
You must be signed in to change notification settings - Fork 103
/
workspace_steps.go
33 lines (28 loc) · 1.03 KB
/
workspace_steps.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package steps
import (
"fmt"
"os"
"path"
"github.com/DATA-DOG/godog"
"github.com/pkg/errors"
)
// WorkspaceSteps defines Cucumber step implementations around Git workspace management.
func WorkspaceSteps(suite *godog.Suite, fs *FeatureState) {
suite.Step(`^my workspace has an uncommitted file$`, func() error {
return fs.activeScenarioState.gitEnvironment.DeveloperRepo.CreateFile("uncommitted file", "uncommitted content")
})
suite.Step(`^my workspace is currently not a Git repository$`, func() error {
os.RemoveAll(path.Join(fs.activeScenarioState.gitEnvironment.DeveloperRepo.Dir, ".git"))
return nil
})
suite.Step(`^my workspace still contains my uncommitted file$`, func() error {
hasFile, err := fs.activeScenarioState.gitEnvironment.DeveloperRepo.HasFile("uncommitted file", "uncommitted content")
if err != nil {
return errors.Wrap(err, "cannot determine if workspace contains uncommitted file")
}
if !hasFile {
return fmt.Errorf("expected the uncommitted file but didn't find one")
}
return nil
})
}