Sha256: c7b26ea0ba3e69fe467f264154ce922a0ae29339103049048311882b6c528ad5

Contents?: true

Size: 1.06 KB

Versions: 50

Compression:

Stored size: 1.06 KB

Contents

require 'rspec/support'
RSpec::Support.require_rspec_support "caller_filter"

module RSpec
  module Support
    module Warnings
      def deprecate(deprecated, options={})
        warn_with "DEPRECATION: #{deprecated} is deprecated.", options
      end

      # @private
      #
      # Used internally to print deprecation warnings
      # when rspec-core isn't loaded
      def warn_deprecation(message, options={})
        warn_with "DEPRECATION: \n #{message}", options
      end

      # @private
      #
      # Used internally to print warnings
      def warning(text, options={})
        warn_with "WARNING: #{text}.", options
      end

      # @private
      #
      # Used internally to print longer warnings
      def warn_with(message, options={})
        call_site = options.fetch(:call_site) { CallerFilter.first_non_rspec_line }
        message << " Use #{options[:replacement]} instead." if options[:replacement]
        message << " Called from #{call_site}." if call_site
        ::Kernel.warn message
      end
    end
  end

  extend RSpec::Support::Warnings
end

Version data entries

50 entries across 46 versions & 16 rubygems

Version Path
opal-rspec-0.8.0 rspec-support/upstream/lib/rspec/support/warnings.rb
opal-rspec-0.8.0.alpha3 rspec-support/upstream/lib/rspec/support/warnings.rb
opal-rspec-0.8.0.alpha2 rspec-support/upstream/lib/rspec/support/warnings.rb
opal-rspec-0.8.0.alpha1 rspec-support/upstream/lib/rspec/support/warnings.rb
opal-rspec-0.7.1 rspec-support/upstream/lib/rspec/support/warnings.rb
opal-rspec-0.7.0 rspec-support/upstream/lib/rspec/support/warnings.rb
opal-rspec-0.6.2 rspec-support/lib/rspec/support/warnings.rb
opal-rspec-0.7.0.rc.2 rspec-support/upstream/lib/rspec/support/warnings.rb
opal-rspec-0.6.1 rspec-support/lib/rspec/support/warnings.rb
opal-rspec-0.6.0 rspec-support/lib/rspec/support/warnings.rb
opal-rspec-0.6.0.beta1 rspec-support/lib/rspec/support/warnings.rb
opal-connect-rspec-0.5.0 rspec-support/lib/rspec/support/warnings.rb
able-neo4j-1.0.0 vendor/bundle/jruby/1.9/gems/rspec-support-3.1.2/lib/rspec/support/warnings.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/rspec-support-3.1.0/lib/rspec/support/warnings.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/rspec-support-3.1.0/lib/rspec/support/warnings.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/rspec-support-3.1.0/lib/rspec/support/warnings.rb
opal-rspec-0.5.0 rspec-support/lib/rspec/support/warnings.rb
logstash-input-beats-2.0.2 vendor/jruby/1.9/gems/logstash-codec-json-2.0.3/vendor/gems/rspec-support-3.1.2/lib/rspec/support/warnings.rb
logstash-input-beats-2.0.2 vendor/jruby/1.9/gems/rspec-support-3.1.2/lib/rspec/support/warnings.rb
logstash-codec-json-2.0.3 vendor/gems/rspec-support-3.1.2/lib/rspec/support/warnings.rb