Module: RSpec::Support::Warnings
- Included in:
- RSpec
- Defined in:
- lib/rspec/support/warnings.rb
Instance Method Summary collapse
- #deprecate(deprecated, options = {}) ⇒ Object
-
#warn_deprecation(message, options = {}) ⇒ Object
Used internally to print deprecation warnings when rspec-core isn’t loaded.
-
#warn_with(message, options = {}) ⇒ Object
Used internally to print longer warnings.
-
#warning(text, options = {}) ⇒ Object
Used internally to print warnings.
Instance Method Details
#deprecate(deprecated, options = {}) ⇒ Object
9 10 11 |
# File 'lib/rspec/support/warnings.rb', line 9 def deprecate(deprecated, ={}) warn_with "DEPRECATION: #{deprecated} is deprecated.", end |
#warn_deprecation(message, options = {}) ⇒ Object
Used internally to print deprecation warnings when rspec-core isn’t loaded
17 18 19 |
# File 'lib/rspec/support/warnings.rb', line 17 def warn_deprecation(, ={}) warn_with "DEPRECATION: \n #{}", end |
#warn_with(message, options = {}) ⇒ Object
Used internally to print longer warnings
31 32 33 34 35 36 |
# File 'lib/rspec/support/warnings.rb', line 31 def warn_with(, ={}) call_site = .fetch(:call_site) { CallerFilter.first_non_rspec_line } += " Use #{[:replacement]} instead." if [:replacement] += " Called from #{call_site}." if call_site Support.warning_notifier.call end |
#warning(text, options = {}) ⇒ Object
Used internally to print warnings
24 25 26 |
# File 'lib/rspec/support/warnings.rb', line 24 def warning(text, ={}) warn_with "WARNING: #{text}.", end |