Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Clear formatters rather than creating new array object, and split exa…

…mple for config.reset

- #435
  • Loading branch information...
commit af6f8863e9b7a579c47b3cb42e80e5a61c915cc3 1 parent 371fc52
@dchelimsky dchelimsky authored
View
1  Changelog.md
@@ -11,6 +11,7 @@
(Arthur Gunn)
* Friendly error message when shared context cannot be found (Sławosz
Sławiński)
+ * Clear formatters when resetting config (John Bintz)
* Bug fixes
* Only eval `let` block once even if it returns `nil` (Adam Meehan)
View
2  lib/rspec/core/configuration.rb
@@ -66,7 +66,7 @@ def initialize
def reset
@reporter = nil
- @formatters = []
+ @formatters.clear if @formatters
end
# :call-seq:
View
11 spec/rspec/core/configuration_spec.rb
@@ -887,9 +887,14 @@ def metadata_hash(*args)
end
describe "#reset" do
- it "resets the reporter and formatters" do
- config.reporter
- config.formatters.should_not be_empty
+ it "clears the reporter" do
+ config.reporter.should_not be_nil
+ config.reset
+ config.instance_variable_get("@reporter").should be_nil
+ end
+
+ it "clears the formatters" do
+ config.add_formatter "doc"
config.reset
config.formatters.should be_empty
end
Please sign in to comment.
Something went wrong with that request. Please try again.