File tree 4 files changed +28
-8
lines changed
java/cucumber/runtime/jruby
resources/cucumber/runtime/jruby
test/resources/cucumber/runtime/jruby/test
4 files changed +28
-8
lines changed Original file line number Diff line number Diff line change @@ -123,12 +123,12 @@ public void registerStepdef(RubyObject stepdefRunner) {
123
123
glue .addStepDefinition (new JRubyStepDefinition (this , stepdefRunner ));
124
124
}
125
125
126
- public void registerBeforeHook (RubyObject procRunner ) {
127
- glue .addBeforeHook (new JRubyHookDefinition (this , new String [ 0 ] , procRunner ));
126
+ public void registerBeforeHook (RubyObject procRunner , String [] tagExpressions ) {
127
+ glue .addBeforeHook (new JRubyHookDefinition (this , tagExpressions , procRunner ));
128
128
}
129
129
130
- public void registerAfterHook (RubyObject procRunner ) {
131
- glue .addAfterHook (new JRubyHookDefinition (this , new String [ 0 ] , procRunner ));
130
+ public void registerAfterHook (RubyObject procRunner , String [] tagExpressions ) {
131
+ glue .addAfterHook (new JRubyHookDefinition (this , tagExpressions , procRunner ));
132
132
}
133
133
134
134
public void registerWorldBlock (RubyObject procRunner ) {
Original file line number Diff line number Diff line change @@ -93,12 +93,12 @@ def pattern
93
93
end
94
94
95
95
module Dsl
96
- def Before ( &proc )
97
- $backend. registerBeforeHook ( HookRunner . new ( proc ) )
96
+ def Before ( * tag_expressions , &proc )
97
+ $backend. registerBeforeHook ( HookRunner . new ( proc ) , tag_expressions )
98
98
end
99
99
100
- def After ( &proc )
101
- $backend. registerAfterHook ( HookRunner . new ( proc ) )
100
+ def After ( * tag_expressions , &proc )
101
+ $backend. registerAfterHook ( HookRunner . new ( proc ) , tag_expressions )
102
102
end
103
103
104
104
def World ( *modules_or_proc )
Original file line number Diff line number Diff line change 1
1
Feature : Cukes
2
2
3
+ @tag
4
+ Scenario : running tagged hook
5
+ Then tagged hook ran
6
+
7
+ Scenario : not running tagged hook
8
+ Then tagged hook didn't run
9
+
3
10
Scenario : in the belly
4
11
Given I have 4 "cukes" in my belly
5
12
Then I am "happy"
Original file line number Diff line number Diff line change
1
+ require 'cucumber/api/jruby/en'
2
+
3
+ Before ( '@tag' ) do
4
+ @tagged_hook_ran = true
5
+ end
6
+
7
+ Then /^tagged hook ran$/ do
8
+ raise "Tagged hook didn't run when it should" unless @tagged_hook_ran
9
+ end
10
+
11
+ Then /^tagged hook didn't run$/ do
12
+ raise "Tagged hook ran when it shouldn't" if @tagged_hook_ran
13
+ end
You can’t perform that action at this time.
0 commit comments