Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit ab227aa

Browse files
committed
pass along opts from warn_deprecation
1 parent 05759fd commit ab227aa

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lib/rspec/core/warnings.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def deprecate(deprecated, data = {})
1818
# @private
1919
#
2020
# Used internally to print deprecation warnings
21-
def warn_deprecation(message)
22-
RSpec.configuration.reporter.deprecation :message => message
21+
def warn_deprecation(message, opts = {})
22+
RSpec.configuration.reporter.deprecation opts.merge( :message => message )
2323
end
2424

2525
def warn_with(message, options = {})

spec/rspec/core/warnings_spec.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,21 @@
2424
expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :message => "this is the message")
2525
RSpec.warn_deprecation("this is the message")
2626
end
27+
28+
it "passes along additional options" do
29+
expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :type => :tag)
30+
RSpec.warn_deprecation("this is the message", :type => :tag)
31+
end
2732
end
2833

2934
describe "#warn_with" do
3035
context "when :use_spec_location_as_call_site => true is passed" do
31-
let(:options) {
36+
let(:options) do
3237
{
3338
:use_spec_location_as_call_site => true,
3439
:call_site => nil,
3540
}
36-
}
41+
end
3742

3843
it "adds the source location of spec" do
3944
line = __LINE__ - 1

0 commit comments

Comments
 (0)