Skip to content
This repository has been archived by the owner on May 12, 2023. It is now read-only.

Commit

Permalink
Having higher-level after blocks also be run for nested contexts.
Browse files Browse the repository at this point in the history
  • Loading branch information
ymendel committed Oct 24, 2008
1 parent 6c8e263 commit 072975b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/bacon.rb
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/spec_bacon.rb
Expand Up @@ -299,6 +299,7 @@ def equal_string(x)

it "should run in the right order" do
@a.should.equal 5
@a = 2
end
end

Expand Down

0 comments on commit 072975b

Please sign in to comment.