Permalink
Browse files

handling And blocks in the report

  • Loading branch information...
1 parent fcba775 commit 123250a282e9421eae8a477bd8b0c9ea98d8ec4f @gugod committed Jun 18, 2009
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/Test/Cukes.pm
View
@@ -35,15 +35,19 @@ sub runtests {
for my $scenario (@scenarios_of_caller) {
my $skip = 0;
my $skip_reason = "";
-
+ my $gwt;
my %steps = %{$steps->{$caller} ||{}};
SKIP:
for my $step_text (@{$scenario->steps}) {
- my (undef, $step) = split " ", $step_text, 2;
+ my ($pre, $step) = split " ", $step_text, 2;
Test::More::skip($step, 1) if $skip;
+ $gwt = $pre if $pre =~ /(Given|When|Then)/;
+
my $found_step = 0;
- while (my ($step_pattern, $cb) = each %steps) {
+ for my $step_pattern (keys %steps) {
+ my $cb = $steps{$step_pattern};
+
if ($step =~ m/$step_pattern/) {
eval { $cb->(); };
Test::More::ok(!$@, $step_text);
@@ -60,6 +64,7 @@ sub runtests {
}
unless($found_step) {
+ $step_text =~ s/^And /$gwt /;
push @missing_steps, $step_text;
}
}

0 comments on commit 123250a

Please sign in to comment.