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

Commit c012b8f

Browse files
committed
Merge pull request #42 from rspec/handle_options_for_warn_deprecation
Pass opts for warn_deprecation
2 parents e914012 + 8fdce36 commit c012b8f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

lib/rspec/support/warnings.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ def deprecate(deprecated, options = {})
99
#
1010
# Used internally to print deprecation warnings
1111
# when rspec-core isn't loaded
12-
def warn_deprecation(message)
13-
warn_with "DEPRECATION: \n #{message}"
12+
def warn_deprecation(message, options = {})
13+
warn_with "DEPRECATION: \n #{message}", options
1414
end
1515

1616
# @private

spec/rspec/support/warnings_spec.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
require "rspec/support/warnings"
33

44
describe "rspec warnings and deprecations" do
5-
subject(:warning_object) {
6-
Object.new.tap {|o| o.extend(RSpec::Support::Warnings)}
7-
}
5+
let(:warning_object) do
6+
Object.new.tap { |o| o.extend(RSpec::Support::Warnings) }
7+
end
88

99
context "when rspec-core is not available" do
1010
shared_examples_for "falling back to Kernel.warn" do |args|
@@ -14,6 +14,11 @@
1414
expect(::Kernel).to receive(:warn).with(/message/)
1515
warning_object.send(method_name, 'message')
1616
end
17+
18+
it "handles being passed options" do
19+
expect(::Kernel).to receive(:warn).with(/message/)
20+
warning_object.send(method_name, "this is the message", :type => :test)
21+
end
1722
end
1823

1924
it_behaves_like 'falling back to Kernel.warn', :method_name => :deprecate

0 commit comments

Comments
 (0)