diff options
author | Gabriel Horner <gabriel.horner@gmail.com> | 2010-03-20 04:19:18 -0400 |
---|---|---|
committer | Gabriel Horner <gabriel.horner@gmail.com> | 2010-03-20 04:19:18 -0400 |
commit | 862244cf77543af841c67e380ef2ee160fed1d76 (patch) | |
tree | 045d2ce1722c3c5b5c6c6901fa3d8367d01b8a84 /lib | |
parent | 0aaf725af9c43ccc97597e6d4621bcc88b290367 (diff) | |
download | bacon-862244cf77543af841c67e380ef2ee160fed1d76.tar.gz bacon-862244cf77543af841c67e380ef2ee160fed1d76.tar.xz bacon-862244cf77543af841c67e380ef2ee160fed1d76.zip |
methods in a context should serve as behavior that is inherited by sibling contexts
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bacon.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/bacon.rb b/lib/bacon.rb index ad4df44..47dc31e 100644 --- a/lib/bacon.rb +++ b/lib/bacon.rb @@ -210,6 +210,9 @@ module Bacon def describe(*args, &block) context = Bacon::Context.new(args.join(' '), &block) + (parent_context = self).methods(false).each {|e| + class<<context; self end.send(:define_method, e) {|*args| parent_context.send(e, *args)} + } @before.each { |b| context.before(&b) } @after.each { |b| context.after(&b) } context.run |