summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2007-12-05 01:49:33 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2007-12-05 01:49:33 +0100
commit4b38b8e7b8943c91c72fa1b5f74c64f9ca94f6d1 (patch)
treedab97a8f4f0ae0608baeb000f4b519e0317beae6 /lib
parent4bd8f7f165ba8113870a6be9ee4f11474aea892d (diff)
downloadbacon-4b38b8e7b8943c91c72fa1b5f74c64f9ca94f6d1.tar.gz
bacon-4b38b8e7b8943c91c72fa1b5f74c64f9ca94f6d1.tar.xz
bacon-4b38b8e7b8943c91c72fa1b5f74c64f9ca94f6d1.zip
Implement -n and -t for filtering on context/specification names
darcs-hash:20071205004933-4fc50-bf25adcb3aa94bded121b452ad17a15a1c38c1f5.gz
Diffstat (limited to 'lib')
-rw-r--r--lib/bacon.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/bacon.rb b/lib/bacon.rb
index 627f79d..0261c88 100644
--- a/lib/bacon.rb
+++ b/lib/bacon.rb
@@ -10,6 +10,9 @@ module Bacon
     raise NameError, "no such context: #{name.inspect}"
   }
 
+  RestrictName    = //  unless defined? RestrictName
+  RestrictContext = //  unless defined? RestrictContext
+
   module SpecDoxOutput
     def handle_specification(name)
       puts name
@@ -102,7 +105,8 @@ module Bacon
       @before = []
       @after = []
       @name = name
-      
+
+      return  unless name =~ RestrictContext
       Bacon.handle_specification(name) do
         instance_eval(&block)
       end
@@ -116,6 +120,7 @@ module Bacon
     end
 
     def it(description, &block)
+      return  unless description =~ RestrictName
       Bacon::Counter[:specifications] += 1
       run_requirement description, block
     end