<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -11,16 +11,16 @@ describe Micronaut::World do
   end
 
   describe &quot;behaviour groups&quot; do
-
+  
     it &quot;should contain all defined behaviour groups&quot; do
       behaviour_group = Micronaut::Behaviour.describe(Bar, 'Empty Behaviour Group') { }
       @world.behaviours.should include(behaviour_group)       
     end
-
+  
   end
-
-  describe &quot;find&quot; do
-
+  
+  describe &quot;applying inclusion filters&quot; do
+  
     before(:all) do
       options_1 = { :foo =&gt; 1, :color =&gt; 'blue', :feature =&gt; 'reporting' }
       options_2 = { :pending =&gt; true, :feature =&gt; 'reporting'  }
@@ -44,55 +44,124 @@ describe Micronaut::World do
       Micronaut.world.behaviours.delete(@bg3)
       Micronaut.world.behaviours.delete(@bg4)
     end
-
+  
     it &quot;should find awesome examples&quot; do
-      @world.find(@bg4.examples, :awesome =&gt; true).should == [@bg4.examples[1], @bg4.examples[2]]
+      @world.apply_inclusion_filters(@bg4.examples, :awesome =&gt; true).should == [@bg4.examples[1], @bg4.examples[2]]
     end
     
     it &quot;should find no groups when given no search parameters&quot; do
-      @world.find([]).should == []
+      @world.apply_inclusion_filters([]).should == []
     end
   
     it &quot;should find three groups when searching for :behaviour_describes =&gt; Bar&quot; do
-      @world.find(@behaviours, :behaviour =&gt; { :describes =&gt; Bar }).should == [@bg1, @bg2, @bg3]
+      @world.apply_inclusion_filters(@behaviours, :behaviour =&gt; { :describes =&gt; Bar }).should == [@bg1, @bg2, @bg3]
     end
     
     it &quot;should find one group when searching for :description =&gt; 'find group-1'&quot; do
-      @world.find(@behaviours, :behaviour =&gt; { :description =&gt; 'find group-1' }).should == [@bg1]
+      @world.apply_inclusion_filters(@behaviours, :behaviour =&gt; { :description =&gt; 'find group-1' }).should == [@bg1]
     end
     
     it &quot;should find two groups when searching for :description =&gt; lambda { |v| v.include?('-1') || v.include?('-3') }&quot; do
-      @world.find(@behaviours, :behaviour =&gt; { :description =&gt; lambda { |v| v.include?('-1') || v.include?('-3') } }).should == [@bg1, @bg3]
+      @world.apply_inclusion_filters(@behaviours, :behaviour =&gt; { :description =&gt; lambda { |v| v.include?('-1') || v.include?('-3') } }).should == [@bg1, @bg3]
     end
     
     it &quot;should find three groups when searching for :description =&gt; /find group/&quot; do
-      @world.find(@behaviours, :behaviour =&gt; { :description =&gt; /find group/ }).should == [@bg1, @bg2, @bg3]
+      @world.apply_inclusion_filters(@behaviours, :behaviour =&gt; { :description =&gt; /find group/ }).should == [@bg1, @bg2, @bg3]
     end
     
     it &quot;should find one group when searching for :foo =&gt; 1&quot; do
-      @world.find(@behaviours, :foo =&gt; 1 ).should == [@bg1]
+      @world.apply_inclusion_filters(@behaviours, :foo =&gt; 1 ).should == [@bg1]
     end
     
     it &quot;should find one group when searching for :pending =&gt; true&quot; do
-      @world.find(@behaviours, :pending =&gt; true ).should == [@bg2]
+      @world.apply_inclusion_filters(@behaviours, :pending =&gt; true ).should == [@bg2]
     end
-
+  
     it &quot;should find one group when searching for :array =&gt; [1,2,3,4]&quot; do
-      @world.find(@behaviours, :array =&gt; [1,2,3,4]).should == [@bg3]
+      @world.apply_inclusion_filters(@behaviours, :array =&gt; [1,2,3,4]).should == [@bg3]
     end
-
+  
     it &quot;should find no group when searching for :array =&gt; [4,3,2,1]&quot; do
-      @world.find(@behaviours, :array =&gt; [4,3,2,1]).should be_empty
+      @world.apply_inclusion_filters(@behaviours, :array =&gt; [4,3,2,1]).should be_empty
     end    
-
+  
     it &quot;should find two groups when searching for :color =&gt; 'blue'&quot; do
-      @world.find(@behaviours, :color =&gt; 'blue').should == [@bg1, @bg3]
+      @world.apply_inclusion_filters(@behaviours, :color =&gt; 'blue').should == [@bg1, @bg3]
     end
-
+  
     it &quot;should find two groups when searching for :feature =&gt; 'reporting' }&quot; do
-      @world.find(@behaviours, :feature =&gt; 'reporting').should == [@bg1, @bg2]
+      @world.apply_inclusion_filters(@behaviours, :feature =&gt; 'reporting').should == [@bg1, @bg2]
+    end
+  
+  end
+  
+  describe &quot;applying exclusion filters&quot; do
+    
+    it &quot;should find nothing if all describes match the exclusion filter&quot; do
+      options = { :network_access =&gt; true }      
+      
+      isolate_behaviour do
+        group1 = Micronaut::Behaviour.describe(Bar, &quot;find group-1&quot;, options) do
+          it(&quot;foo&quot;) {}
+          it(&quot;bar&quot;) {}
+        end
+        
+        @world.apply_exclusion_filters(group1.examples, :network_access =&gt; true).should == []
+      end
+      
+      isolate_behaviour do
+        group2 = Micronaut::Behaviour.describe(Bar, &quot;find group-1&quot;) do
+          it(&quot;foo&quot;, :network_access =&gt; true) {}
+          it(&quot;bar&quot;) {}
+        end
+        
+        @world.apply_exclusion_filters(group2.examples, :network_access =&gt; true).should == [group2.examples.last]
+      end
+  
+    end
+    
+    it &quot;should find nothing if a regexp matches the exclusion filter&quot; do
+      isolate_behaviour do
+        group = Micronaut::Behaviour.describe(Bar, &quot;find group-1&quot;, :name =&gt; &quot;exclude me with a regex&quot;, :another =&gt; &quot;foo&quot;) do
+          it(&quot;foo&quot;) {}
+          it(&quot;bar&quot;) {}
+        end
+        @world.apply_exclusion_filters(group.examples, :name =&gt; /exclude/).should == []
+        @world.apply_exclusion_filters(group.examples, :name =&gt; /exclude/, :another =&gt; &quot;foo&quot;).should == []
+        @world.apply_exclusion_filters(group.examples, :name =&gt; /exclude/, :another =&gt; &quot;foo&quot;, :behaviour =&gt; {
+          :describes =&gt; lambda { |b| b == Bar } } ).should == []
+        
+        @world.apply_exclusion_filters(group.examples, :name =&gt; /exclude not/).should == group.examples
+        @world.apply_exclusion_filters(group.examples, :name =&gt; /exclude/, &quot;another_condition&quot; =&gt; &quot;foo&quot;).should == group.examples
+        @world.apply_exclusion_filters(group.examples, :name =&gt; /exclude/, &quot;another_condition&quot; =&gt; &quot;foo1&quot;).should == group.examples
+      end
+    end
+    
+  end
+  
+  describe &quot;filtering behaviours&quot; do
+    
+    before(:all) do
+      @group1 = Micronaut::Behaviour.describe(Bar, &quot;find these examples&quot;) do
+        it('I have no options',       :color =&gt; :red, :awesome =&gt; true) {}
+        it(&quot;I also have no options&quot;,  :color =&gt; :red, :awesome =&gt; true) {}
+        it(&quot;not so awesome&quot;,          :color =&gt; :red, :awesome =&gt; false) {}
+      end
+    end
+    
+    after(:all) do
+      Micronaut.world.behaviours.delete(@group1)
     end
 
+    it &quot;should run matches&quot; do
+      Micronaut.world.stubs(:exclusion_filter).returns({ :awesome =&gt; false })
+      Micronaut.world.stubs(:filter).returns({ :color =&gt; :red })
+      Micronaut.world.stubs(:behaviours).returns([@group1])
+      filtered_behaviours = @world.filter_behaviours
+      filtered_behaviours.should == [@group1]
+      @group1.examples_to_run.should == @group1.examples[0..1]      
+    end
+    
   end
 
 end
\ No newline at end of file</diff>
      <filename>examples/lib/micronaut/world_example.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,6 +10,8 @@ module Micronaut
     # Allows you to control what examples are ran by filtering 
     attr_reader :filter
     
+    attr_reader :exclusion_filter
+    
     # Modules that will be included or extended based on given filters
     attr_reader :include_or_extend_modules
     
@@ -34,7 +36,7 @@ module Micronaut
       @before_and_afters = { :before =&gt; { :each =&gt; [], :all =&gt; [] }, :after =&gt; { :each =&gt; [], :all =&gt; [] } }
       @include_or_extend_modules = []
       @formatter_to_use = Micronaut::Formatters::ProgressFormatter
-      @filter = nil
+      @filter, @exclusion_filter = nil, nil
       mock_with nil unless @mock_framework_established
     end
     </diff>
      <filename>lib/micronaut/configuration.rb</filename>
    </modified>
    <modified>
      <diff>@@ -37,11 +37,11 @@ module Micronaut
       end
       
       def pending_examples
-        @pending_examples ||= ::Micronaut.world.find(examples, :execution_result =&gt; { :status =&gt; 'pending' })
+        @pending_examples ||= ::Micronaut.world.find(examples, :positive, :execution_result =&gt; { :status =&gt; 'pending' })
       end
       
       def failed_examples
-        @failed_examples ||= ::Micronaut.world.find(examples, :execution_result =&gt; { :status =&gt; 'failed' })
+        @failed_examples ||= ::Micronaut.world.find(examples, :positive, :execution_result =&gt; { :status =&gt; 'failed' })
       end
 
       # This method is invoked before any examples are run, right after</diff>
      <filename>lib/micronaut/formatters/base_formatter.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,12 +11,17 @@ module Micronaut
     def filter
       Micronaut.configuration.filter
     end
+    
+    def exclusion_filter
+      Micronaut.configuration.exclusion_filter
+    end
 
     def behaviours_to_run
       return @behaviours_to_run if @behaviours_to_run
       
-      if filter
+      if filter || exclusion_filter
         @behaviours_to_run = filter_behaviours
+        p @behaviours_to_run
         if @behaviours_to_run.size == 0 &amp;&amp; Micronaut.configuration.run_all_when_everything_filtered?
           puts &quot;No examples were matched by #{filter.inspect}, running all&quot;
           # reset the behaviour list to all behaviours, and add back all examples
@@ -38,21 +43,38 @@ module Micronaut
     end
 
     def filter_behaviours
-      behaviours.inject([]) do |list, b|
-        b.examples_to_run.replace(find(b.examples, filter).uniq)
-        # Do not add behaviours with 0 examples to run
-        list &lt;&lt; (b.examples_to_run.size == 0 ? nil : b)
+      behaviours.inject([]) do |list_of_behaviors, _behavior|
+        examples = _behavior.examples
+        examples = apply_exclusion_filters(examples, exclusion_filter) if exclusion_filter
+        examples = apply_inclusion_filters(examples, filter) if filter
+        examples.uniq!
+        _behavior.examples_to_run.replace(examples)
+        if examples.empty?
+          list_of_behaviors &lt;&lt; nil
+        else
+          list_of_behaviors &lt;&lt; _behavior
+        end
       end.compact
     end
 
-    def find(collection, conditions={})
+    def find(collection, type_of_filter=:positive, conditions={})
+      negative = type_of_filter != :positive
+      
       collection.select do |item|
-        conditions.all? { |filter_on, filter| apply_condition(filter_on, filter, item.metadata) }
+        # negative conditions.any?, positive conditions.all? ?????
+        result = conditions.all? do |filter_on, filter| 
+                   apply_condition(filter_on, filter, item.metadata)
+                 end
+        negative ? !result : result
       end
     end
     
-    def find_behaviours(conditions={})
-      find(behaviours, conditions)
+    def apply_inclusion_filters(collection, conditions={})
+      find(collection, :positive, conditions)
+    end
+    
+    def apply_exclusion_filters(collection, conditions={})
+      find(collection, :negative, conditions)
     end
 
     def apply_condition(filter_on, filter, metadata)</diff>
      <filename>lib/micronaut/world.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6c83c03fe94dc836a7c08c6e855cb5f8dbe13bcf</id>
    </parent>
    <parent>
      <id>a7220683bb449ee56a4096b596c4749d15f2afa9</id>
    </parent>
  </parents>
  <author>
    <name>Chad Humphries</name>
    <email>chad@spicycode.com</email>
  </author>
  <url>http://github.com/spicycode/micronaut/commit/c933e574fbdc1b9c7cf0c96edb39f6d48330b34c</url>
  <id>c933e574fbdc1b9c7cf0c96edb39f6d48330b34c</id>
  <committed-date>2009-05-29T08:01:37-07:00</committed-date>
  <authored-date>2009-05-29T08:01:37-07:00</authored-date>
  <message>Merge branch 'negative_filters'</message>
  <tree>3e43a1cba6895c4f4673cbff3627ce2d81b9e759</tree>
  <committer>
    <name>Chad Humphries</name>
    <email>chad@spicycode.com</email>
  </committer>
</commit>
