diff options
author | Yossef Mendelssohn <ymendel@pobox.com> | 2008-10-24 17:20:17 -0500 |
---|---|---|
committer | Yossef Mendelssohn <ymendel@pobox.com> | 2008-10-24 17:20:17 -0500 |
commit | 072975b523a5ce6c76a3e826876ae358060b60ce (patch) | |
tree | a3208f50129605786a4b1b3400abad10e1c6fa25 /lib | |
parent | 6c8e263c5edfc3627dc004a1c26b19be6a25ca6b (diff) | |
download | bacon-072975b523a5ce6c76a3e826876ae358060b60ce.tar.gz bacon-072975b523a5ce6c76a3e826876ae358060b60ce.tar.xz bacon-072975b523a5ce6c76a3e826876ae358060b60ce.zip |
Having higher-level after blocks also be run for nested contexts.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bacon.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/bacon.rb b/lib/bacon.rb index 256cd0c..232b2df 100644 --- a/lib/bacon.rb +++ b/lib/bacon.rb @@ -258,7 +258,9 @@ module Kernel private def describe(*args, &block) context = Bacon::Context.new(args.join(' '), &block) - (instance_variable_get('@before') || []).each { |b| context.before &b } + %w[before after].each do |block_type| + (instance_variable_get("@#{block_type}") || []).each { |b| context.send(block_type, &b) } + end context.run context end |