Permalink
Browse files

add filter_run_excluding

  • Loading branch information...
1 parent bf5a6c4 commit 2dc6eee7a9b53eafa08931d53e674782eb217fde @dchelimsky dchelimsky committed Jun 14, 2010
Showing with 23 additions and 3 deletions.
  1. +7 −1 lib/rspec/core/configuration.rb
  2. +14 −0 spec/rspec/core/configuration_spec.rb
  3. +2 −2 spec/spec_helper.rb
@@ -213,10 +213,16 @@ def alias_example_to(new_name, extra_options={})
RSpec::Core::ExampleGroup.alias_example_to(new_name, extra_options)
end
- def filter_run(options={})
+ def filter_run_including(options={})
self.filter = options unless filter and filter[:line_number] || filter[:full_description]
end
+ alias_method :filter_run, :filter_run_including
+
+ def filter_run_excluding(options={})
+ self.exclusion_filter = options
+ end
+
def include(mod, filters={})
include_or_extend_modules << [:include, mod, filters]
end
@@ -252,6 +252,20 @@ def that_thing
end
+ describe "#filter_run" do
+ it "sets the filter" do
+ config.filter_run :focus => true
+ config.filter.should eq({:focus => true})
+ end
+ end
+
+ describe "#filter_run_excluding" do
+ it "sets the filter" do
+ config.filter_run_excluding :slow => true
+ config.exclusion_filter.should eq({:slow => true})
+ end
+ end
+
describe "line_number=" do
it "sets the line number" do
config.line_number = '37'
View
@@ -54,9 +54,9 @@ def in_editor?
c.color_enabled = !in_editor?
c.filter_run :focus => true
c.run_all_when_everything_filtered = true
- c.exclusion_filter = { :ruby => lambda {|version|
+ c.filter_run_excluding :ruby => lambda {|version|
!(RUBY_VERSION.to_s =~ /^#{version.to_s}/)
- }}
+ }
c.before(:each) do
@real_world = RSpec.world
RSpec.instance_variable_set(:@world, RSpec::Core::World.new)

0 comments on commit 2dc6eee

Please sign in to comment.