Module: RSpec::Support::Warnings

Included in:
RSpec
Defined in:
opal/opal/rspec/fixes/rspec/support/warnings.rb

Instance Method Summary collapse

Instance Method Details

#warn_with(message, options = {}) ⇒ Object Also known as: support_warn_with



4
5
6
7
8
9
10
11
12
# File 'opal/opal/rspec/fixes/rspec/support/warnings.rb', line 4

def warn_with(message, options={})
  call_site = options.fetch(:call_site) { CallerFilter.first_non_rspec_line }
  # mutable strings
  # message << " Use #{options[:replacement]} instead." if options[:replacement]
  message += " Use #{options[:replacement]} instead." if options[:replacement]
  # message << " Called from #{call_site}." if call_site
  message += " Called from #{call_site}." if call_site
  ::Kernel.warn message
end