Sha256: da17afb9c7e259eebbc90bd0fd6bd8276e09684a33148f774d5e2af76745e453

Contents?: true

Size: 1.58 KB

Versions: 4913

Compression:

Stored size: 1.58 KB

Contents

module RSpecHelpers
  def expect_deprecation_with_call_site(file, line, snippet=//)
    expect(RSpec.configuration.reporter).to receive(:deprecation).
      with(include(:deprecated => match(snippet), :call_site => include([file, line].join(':'))))
  end

  def expect_deprecation_without_call_site(snippet=//)
    expect(RSpec.configuration.reporter).to receive(:deprecation).
      with(include(:deprecated => match(snippet), :call_site => eq(nil)))
  end

  def expect_warn_deprecation_with_call_site(file, line, snippet=//)
    expect(RSpec.configuration.reporter).to receive(:deprecation).
      with(include(:message => match(snippet), :call_site => include([file, line].join(':'))))
  end

  def expect_warn_deprecation(snippet=//)
    expect(RSpec.configuration.reporter).to receive(:deprecation).
      with(include(:message => match(snippet)))
  end

  def allow_deprecation
    allow(RSpec.configuration.reporter).to receive(:deprecation)
  end

  def expect_no_deprecations
    expect(RSpec.configuration.reporter).not_to receive(:deprecation)
  end
  alias expect_no_deprecation expect_no_deprecations

  def expect_warning_without_call_site(expected=//)
    expect(::Kernel).to receive(:warn).
      with(match(expected).and(satisfy { |message| !(/Called from/ =~ message) }))
  end

  def expect_warning_with_call_site(file, line, expected=//)
    expect(::Kernel).to receive(:warn).
      with(match(expected).and(match(/Called from #{file}:#{line}/)))
  end

  def expect_no_warnings
    expect(::Kernel).not_to receive(:warn)
  end

  def allow_warning
    allow(::Kernel).to receive(:warn)
  end
end

Version data entries

4,913 entries across 4,904 versions & 44 rubygems

Version Path
mux_ruby-3.20.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/spec/deprecation_helpers.rb
mux_ruby-3.19.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/spec/deprecation_helpers.rb
moneykit-0.1.15 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/spec/deprecation_helpers.rb
moneykit-0.1.14 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/spec/deprecation_helpers.rb
mux_ruby-3.18.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/spec/deprecation_helpers.rb
moneykit-0.1.13 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/spec/deprecation_helpers.rb
moneykit-0.1.12 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/spec/deprecation_helpers.rb
moneykit-0.1.11 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/spec/deprecation_helpers.rb
mux_ruby-3.17.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/spec/deprecation_helpers.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.10.2/lib/rspec/support/spec/deprecation_helpers.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.10.2/lib/rspec/support/spec/deprecation_helpers.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.10.2/lib/rspec/support/spec/deprecation_helpers.rb
moneykit-0.1.10 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/spec/deprecation_helpers.rb
moneykit-0.1.9 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/spec/deprecation_helpers.rb
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/spec/deprecation_helpers.rb
mux_ruby-3.15.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/spec/deprecation_helpers.rb
avalara_sdk-24.2.29 vendor/bundle/ruby/2.7.0/gems/rspec-support-3.11.0/lib/rspec/support/spec/deprecation_helpers.rb
mux_ruby-3.14.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/spec/deprecation_helpers.rb
moneykit-0.1.6 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_id_ruby-0.113.118 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/spec/deprecation_helpers.rb