1 require 'cucumber/formatter/pretty'
3 # Sort of inspired by Cucumber::RbSupport::RbHook, but really we just
4 # want an object with a 'tag_expressions' attribute to make
5 # accept_hook?() (used below) happy.
7 attr_reader :tag_expressions
9 def initialize(tag_expressions, proc)
10 @tag_expressions = tag_expressions
19 def BeforeFeature(*tag_expressions, &block)
20 $before_feature_hooks ||= []
21 $before_feature_hooks << SimpleHook.new(tag_expressions, block)
24 def AfterFeature(*tag_expressions, &block)
25 $after_feature_hooks ||= []
26 $after_feature_hooks << SimpleHook.new(tag_expressions, block)
30 class Pretty < Cucumber::Formatter::Pretty
31 def before_feature(feature)
32 for hook in $before_feature_hooks do
33 hook.invoke(feature) if feature.accept_hook?(hook)
35 super if defined?(super)
38 def after_feature(feature)
39 for hook in $after_feature_hooks do
40 hook.invoke(feature) if feature.accept_hook?(hook)
42 super if defined?(super)