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

Pass opts for warn_deprecation #42

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/support/warnings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ def deprecate(deprecated, options = {})
#
# Used internally to print deprecation warnings
# when rspec-core isn't loaded
def warn_deprecation(message)
warn_with "DEPRECATION: \n #{message}"
def warn_deprecation(message, options = {})
warn_with "DEPRECATION: \n #{message}", options
end

# @private
Expand Down
11 changes: 8 additions & 3 deletions spec/rspec/support/warnings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
require "rspec/support/warnings"

describe "rspec warnings and deprecations" do
subject(:warning_object) {
Object.new.tap {|o| o.extend(RSpec::Support::Warnings)}
}
let(:warning_object) do
Object.new.tap { |o| o.extend(RSpec::Support::Warnings) }
end

context "when rspec-core is not available" do
shared_examples_for "falling back to Kernel.warn" do |args|
Expand All @@ -14,6 +14,11 @@
expect(::Kernel).to receive(:warn).with(/message/)
warning_object.send(method_name, 'message')
end

it "handles being passed options" do
expect(::Kernel).to receive(:warn).with(/message/)
warning_object.send(method_name, "this is the message", :type => :test)
end
end

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