Sha256: d3a721e2c359a275a8a31541cc0b5ec416987f1e36a1554c86c3a86f3ffa4474

Contents?: true

Size: 1.61 KB

Versions: 2057

Compression:

Stored size: 1.61 KB

Contents

# frozen_string_literal: true

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

2,057 entries across 2,056 versions & 17 rubygems

Version Path
cybrid_api_organization_ruby-0.123.163 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/rspec-support-3.13.1/lib/rspec/support/spec/deprecation_helpers.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_organization_ruby-0.123.162 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_id_ruby-0.123.162 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_id_ruby-0.123.161 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_organization_ruby-0.123.161 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_organization_ruby-0.123.160 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_id_ruby-0.123.160 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_organization_ruby-0.123.159 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_id_ruby-0.123.159 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_id_ruby-0.123.158 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_organization_ruby-0.123.158 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_id_ruby-0.123.157 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_organization_ruby-0.123.157 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_organization_ruby-0.123.156 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_id_ruby-0.123.156 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
messente_api-2.3.0 vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_bank_ruby-0.123.153 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb
cybrid_api_id_ruby-0.123.153 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/spec/deprecation_helpers.rb