forked from rspec/rspec-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwarnings.rb
40 lines (35 loc) · 1022 Bytes
/
warnings.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require "rspec/support/warnings"
module RSpec
module Core
# @private
module Warnings
# @private
#
# Used internally to print deprecation warnings.
def deprecate(deprecated, data={})
RSpec.configuration.reporter.deprecation(
{
:deprecated => deprecated,
:call_site => CallerFilter.first_non_rspec_line
}.merge(data)
)
end
# @private
#
# Used internally to print deprecation warnings.
def warn_deprecation(message, opts={})
RSpec.configuration.reporter.deprecation opts.merge(:message => message)
end
# @private
def warn_with(message, options={})
if options[:use_spec_location_as_call_site]
message += "." unless message.end_with?(".")
if RSpec.current_example
message += " Warning generated from spec at `#{RSpec.current_example.location}`."
end
end
super(message, options)
end
end
end
end