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

Pass along opts from warn_deprecation #1342

Merged
merged 1 commit into from
Feb 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/rspec/core/warnings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def deprecate(deprecated, data = {})
# @private
#
# Used internally to print deprecation warnings
def warn_deprecation(message)
RSpec.configuration.reporter.deprecation :message => message
def warn_deprecation(message, opts = {})
RSpec.configuration.reporter.deprecation opts.merge( :message => message )
end

def warn_with(message, options = {})
Expand Down
9 changes: 7 additions & 2 deletions spec/rspec/core/warnings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,21 @@
expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :message => "this is the message")
RSpec.warn_deprecation("this is the message")
end

it "passes along additional options" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind adding a blank line above this? I personally dislike having examples crammed next to each other unless they are one-liners.

expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :type => :tag)
RSpec.warn_deprecation("this is the message", :type => :tag)
end
end

describe "#warn_with" do
context "when :use_spec_location_as_call_site => true is passed" do
let(:options) {
let(:options) do
{
:use_spec_location_as_call_site => true,
:call_site => nil,
}
}
end

it "adds the source location of spec" do
line = __LINE__ - 1
Expand Down