diff --git a/features/bootstrap/godog_test.go b/features/bootstrap/godog_test.go index e9fd0d9..9c27a4e 100644 --- a/features/bootstrap/godog_test.go +++ b/features/bootstrap/godog_test.go @@ -50,8 +50,8 @@ func TestIntegration(t *testing.T) { ) RunSuite(t, "..", func(_ *testing.T, ctx *godog.ScenarioContext) { - m.RegisterContext(ctx) - w.registerContext(ctx) + m.RegisterSteps(ctx) + w.RegisterSteps(ctx) }) } diff --git a/features/bootstrap/writer.go b/features/bootstrap/writer.go index e8f8f2d..c6282ae 100644 --- a/features/bootstrap/writer.go +++ b/features/bootstrap/writer.go @@ -9,8 +9,8 @@ type writer struct { console *expect.Console } -func (w *writer) registerContext(ctx *godog.ScenarioContext) { - ctx.Step(`write to console:`, func(s *godog.DocString) error { +func (w *writer) RegisterSteps(s *godog.ScenarioContext) { + s.Step(`write to console:`, func(s *godog.DocString) error { _, err := w.console.Write([]byte(s.Content)) return err diff --git a/manager.go b/manager.go index e93916a..b6bc35f 100644 --- a/manager.go +++ b/manager.go @@ -49,21 +49,28 @@ type tHelper interface { } // RegisterContext register console Manager to test context. -func (m *Manager) RegisterContext(ctx *godog.ScenarioContext) { - ctx.Before(func(_ context.Context, sc *godog.Scenario) (context.Context, error) { +// +// Deprecated: Use Manager.RegisterSteps instead. +func (m *Manager) RegisterContext(s *godog.ScenarioContext) { + m.RegisterSteps(s) +} + +// RegisterSteps register console Manager to test context. +func (m *Manager) RegisterSteps(s *godog.ScenarioContext) { + s.Before(func(_ context.Context, sc *godog.Scenario) (context.Context, error) { m.NewConsole(sc) return nil, nil }) - ctx.After(func(_ context.Context, sc *godog.Scenario, _ error) (context.Context, error) { + s.After(func(_ context.Context, sc *godog.Scenario, _ error) (context.Context, error) { m.CloseConsole(sc) return nil, nil }) - ctx.Step(`console output is:`, m.isConsoleOutput) - ctx.Step(`console output matches:`, m.matchConsoleOutput) + s.Step(`console output is:`, m.isConsoleOutput) + s.Step(`console output matches:`, m.matchConsoleOutput) } func (m *Manager) session() *session {