MCPcopy Create free account
hub / github.com/conforma/cli / AddStepsTo

Function AddStepsTo

acceptance/git/git.go:316–344  ·  view source on GitHub ↗

AddStepsTo adds Gherkin steps to the godog ScenarioContext

(sc *godog.ScenarioContext)

Source from the content-addressed store, hash-verified

314
315// AddStepsTo adds Gherkin steps to the godog ScenarioContext
316func AddStepsTo(sc *godog.ScenarioContext) {
317 sc.Step(`^stub git daemon running$`, startStubGitServer)
318 sc.Step(`^a git repository named "([^"]*)" with$`, createGitRepository)
319
320 // removes all git repositories from the filesystem and terminates the container
321 sc.After(func(ctx context.Context, finished *godog.Scenario, scenarioErr error) (context.Context, error) {
322 if testenv.Persisted(ctx) {
323 return ctx, nil
324 }
325
326 var state *gitState
327 if ctx, err := testenv.SetupState(ctx, &state); err != nil {
328 return ctx, err
329 }
330
331 if state.Container != nil {
332 if err := state.Container.Terminate(ctx); err != nil {
333 logger, _ := log.LoggerFor(ctx)
334 logger.Warnf("failed to terminate git container: %v", err)
335 }
336 }
337
338 if state.RepositoriesDir != "" {
339 os.RemoveAll(state.RepositoriesDir)
340 }
341
342 return ctx, nil
343 })
344}

Callers 1

initializeScenarioFunction · 0.92

Calls 4

PersistedFunction · 0.92
SetupStateFunction · 0.92
LoggerForFunction · 0.92
WarnfMethod · 0.65

Tested by 1

initializeScenarioFunction · 0.74