Sha256: 52431e1cdb3611176e8f637735875a9667008e525687f2a26e593912ea1432c9

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

# not 100% sure this compat check fixes this, but it's pretty close
unless Opal::RSpec::Compatibility.multiple_module_include_super_works_right?
  require 'opal/rspec/fixes/rspec/support/warnings'

  module ::RSpec::Core::Warnings
    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 won't find this
      # super(message, options)
      # let's inline the method
      call_site = options.fetch(:call_site) { ::RSpec::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
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
opal-rspec-0.8.0 lib-opal/opal/rspec/fixes/rspec/core/warnings.rb
opal-rspec-0.8.0.alpha3 lib-opal/opal/rspec/fixes/rspec/core/warnings.rb
opal-rspec-0.8.0.alpha2 lib-opal/opal/rspec/fixes/rspec/core/warnings.rb
opal-rspec-0.8.0.alpha1 lib-opal/opal/rspec/fixes/rspec/core/warnings.rb
opal-rspec-0.7.1 lib-opal/opal/rspec/fixes/rspec/core/warnings.rb
opal-rspec-0.7.0 lib-opal/opal/rspec/fixes/rspec/core/warnings.rb
opal-rspec-0.7.0.rc.2 lib-opal/opal/rspec/fixes/rspec/core/warnings.rb
opal-rspec-0.7.0.rc.1 lib-opal/opal/rspec/fixes/rspec/core/warnings.rb