Sha256: 132e7c157c89bd017397d346cb8149cfd77e3d11b55fa6210a611f07fec35844

Contents?: true

Size: 1 KB

Versions: 8

Compression:

Stored size: 1 KB

Contents

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

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
rspec-core-3.0.4 lib/rspec/core/warnings.rb
rspec-core-3.0.3 lib/rspec/core/warnings.rb
rspec-core-3.0.2 lib/rspec/core/warnings.rb
whos_dated_who-0.1.0 vendor/bundle/gems/rspec-core-3.0.1/lib/rspec/core/warnings.rb
whos_dated_who-0.0.1 vendor/bundle/gems/rspec-core-3.0.1/lib/rspec/core/warnings.rb
rspec-core-3.0.1 lib/rspec/core/warnings.rb
rspec-core-3.0.0 lib/rspec/core/warnings.rb
rspec-core-3.0.0.rc1 lib/rspec/core/warnings.rb