This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ Bug Fixes:
70
70
where filtered to a particular location. (Ben Axnick, #1963 )
71
71
* Fix time formatting logic so that it displays 70 seconds as "1 minute,
72
72
10 seconds" rather than "1 minute, 1 second". (Paul Brennan, #1984 )
73
+ * Fix regression where the formatter loader would allow duplicate formatters.
74
+ (Jon Rowe, #1990 )
73
75
74
76
### 3.2.3 / 2015-04-06
75
77
[ Full Changelog] ( http://github.com/rspec/rspec-core/compare/v3.2.2...v3.2.3 )
Original file line number Diff line number Diff line change @@ -143,9 +143,11 @@ def add(formatter_to_use, *paths)
143
143
144
144
if !Loader . formatters [ formatter_class ] . nil?
145
145
formatter = formatter_class . new ( *args )
146
+ return formatter if duplicate_formatter_exists? ( formatter )
146
147
@reporter . register_listener formatter , *notifications_for ( formatter_class )
147
148
elsif defined? ( RSpec ::LegacyFormatters )
148
149
formatter = RSpec ::LegacyFormatters . load_formatter formatter_class , *args
150
+ return formatter if duplicate_formatter_exists? ( formatter )
149
151
@reporter . register_listener formatter , *formatter . notifications
150
152
else
151
153
call_site = "Formatter added at: #{ ::RSpec ::CallerFilter . first_non_rspec_line } "
@@ -163,7 +165,7 @@ def add(formatter_to_use, *paths)
163
165
WARNING
164
166
return
165
167
end
166
- @formatters << formatter unless duplicate_formatter_exists? ( formatter )
168
+ @formatters << formatter
167
169
formatter
168
170
end
169
171
Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ module RSpec::Core::Formatters
117
117
before { loader . add :documentation , output }
118
118
119
119
it "doesn't add the formatter for the same output target" do
120
+ expect ( reporter ) . to_not receive ( :register_listener )
120
121
expect {
121
122
loader . add :documentation , output
122
123
} . not_to change { loader . formatters . length }
You can’t perform that action at this time.
0 commit comments