Permalink
Browse files

RSpec.reset resets filters

- Fixes #621
  • Loading branch information...
1 parent 5ea6d86 commit ba15a2ed68132d5d1e0007d41e95f3906c8c5458 @dchelimsky dchelimsky committed May 18, 2012
View
@@ -12,6 +12,10 @@ Enhancements
* thanks to Bradley Schaefer for suggesting it and Avdi Grimm for almost
suggesting it.
+Bug fixes
+
+* `RSpec.reset` also resets filters.
+
### 2.10.0 / 2012-05-03
[full changelog](http://github.com/rspec/rspec-core/compare/v2.9.0...v2.10.0)
@@ -209,6 +209,7 @@ def force(hash)
def reset
@reporter = nil
@formatters.clear
+ filter_manager.reset
end
# @overload add_setting(name)
@@ -115,11 +115,15 @@ def _warn_deprecated_key(key, updates)
attr_reader :exclusions, :inclusions
def initialize
- @exclusions = DEFAULT_EXCLUSIONS.dup.extend(Describable)
- @inclusions = {}.extend(Describable)
+ reset
extend(BackwardCompatibility)
end
+ def reset
+ @inclusions = {}.extend(Describable)
+ @exclusions = DEFAULT_EXCLUSIONS.dup.extend(Describable)
+ end
+
def add_location(file_path, line_numbers)
# locations is a hash of expanded paths to arrays of line
# numbers to match against. e.g.
@@ -1101,6 +1101,11 @@ def metadata_hash(*args)
config.reset
config.formatters.should be_empty
end
+
+ it "resets the filter_manager" do
+ config.filter_manager.should_receive(:reset)
+ config.reset
+ end
end
describe "#force" do
@@ -252,5 +252,21 @@ def filterable_object_with(args = {})
filter_manager.inclusions.should eq(filter => "a_value")
end
end
+
+ describe "#reset" do
+ it "clears the inclusions" do
+ filter_manager = FilterManager.new
+ filter_manager.include :foo => :bar
+ filter_manager.reset
+ filter_manager.inclusions.should be_empty
+ end
+
+ it "clears the exclusions" do
+ filter_manager = FilterManager.new
+ filter_manager.exclude :foo => :bar
+ filter_manager.reset
+ filter_manager.exclusions.should eq(FilterManager::DEFAULT_EXCLUSIONS)
+ end
+ end
end
end

0 comments on commit ba15a2e

Please sign in to comment.