Skip to content

Commit

Permalink
Merge pull request pherkin#104 from ehuelsmann/fix-96
Browse files Browse the repository at this point in the history
Remove ref to now-removed Step stash; make 2 stash lines equivalent
  • Loading branch information
ehuelsmann committed Sep 4, 2016
2 parents bb3e59f + bc6bced commit 029d7f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/Test/BDD/Cucumber/Manual/Steps.pod
Expand Up @@ -61,7 +61,7 @@ equivalent:
sub { C->matches->[0] }

# Set a value in the scenario-level stash
sub { my $context = shift; my $stash = $context->stash; $stash->{'count'} = 1 }
sub { my $context = shift; my $stash = $context->stash->{'scenario'}; $stash->{'count'} = 1 }
sub { S->{'count'} = 1 }

We will evaluate the regex immediately before we execute the coderef, so you
Expand Down
8 changes: 3 additions & 5 deletions lib/Test/BDD/Cucumber/StepContext.pm
Expand Up @@ -47,15 +47,13 @@ has '_data' =>

=head2 stash
A hash of hashes, containing three keys, C<feature>, C<scenario> and C<step>.
The stash allows you to persist data across features, scenarios, or steps
(although the latter is there for completeness, rather than having any useful
function).
A hash of hashes, containing two keys, C<feature>, C<scenario>.
The stash allows you to persist data across features or scenarios.
The scenario-level stash is also available to steps by calling C<S()>, making
the following two lines of code equivalent:
sub { my $context = shift; my $stash = $context->stash; $stash->{'count'} = 1 }
sub { my $context = shift; my $stash = $context->stash->{'scenario'}; $stash->{'count'} = 1 }
sub { S->{'count'} = 1 }
=cut
Expand Down

0 comments on commit 029d7f8

Please sign in to comment.