@@ -141,6 +141,12 @@ func InitializeScenario(ctx *ScenarioContext) {
141
141
}
142
142
})
143
143
144
+ ctx .Step (`I store value "([^"]*)"$` , tc .iStoreValue )
145
+ ctx .Step (`^the stored value is "([^"]*)"$` , tc .theStoredValueIs )
146
+ ctx .Step (`^I run multisteps that set a value$` , func () Steps {
147
+ return Steps {`I store value "{{X}}"` }
148
+ })
149
+
144
150
ctx .StepContext ().Before (tc .inject )
145
151
}
146
152
@@ -365,6 +371,23 @@ func (tc *godogFeaturesScenario) iShouldSeeTheContextInTheNextStep(ctx context.C
365
371
return nil
366
372
}
367
373
374
+ type valueContextKey struct {}
375
+
376
+ func (tc * godogFeaturesScenario ) iStoreValue (ctx context.Context , value string ) context.Context {
377
+ return context .WithValue (ctx , valueContextKey {}, value )
378
+ }
379
+
380
+ func (tc * godogFeaturesScenario ) theStoredValueIs (ctx context.Context , want string ) error {
381
+ got , ok := ctx .Value (valueContextKey {}).(string )
382
+ if ! ok {
383
+ return errors .New ("context does not contain our key" )
384
+ }
385
+ if got != want {
386
+ return fmt .Errorf ("context has the wrong value for our key: got %s, want %s" , got , want )
387
+ }
388
+ return nil
389
+ }
390
+
368
391
func (tc * godogFeaturesScenario ) followingStepsShouldHave (status string , steps * DocString ) error {
369
392
var expected = strings .Split (steps .Content , "\n " )
370
393
var actual , unmatched , matched []string
0 commit comments