@@ -141,6 +141,12 @@ func InitializeScenario(ctx *ScenarioContext) {
141141 }
142142 })
143143
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+
144150 ctx .StepContext ().Before (tc .inject )
145151}
146152
@@ -365,6 +371,23 @@ func (tc *godogFeaturesScenario) iShouldSeeTheContextInTheNextStep(ctx context.C
365371 return nil
366372}
367373
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+
368391func (tc * godogFeaturesScenario ) followingStepsShouldHave (status string , steps * DocString ) error {
369392 var expected = strings .Split (steps .Content , "\n " )
370393 var actual , unmatched , matched []string
0 commit comments