Sha256: 2b0f3d568cf5c77fa33f20021959710584b62269980c4d9674328b0ad1908e32

Contents?: true

Size: 645 Bytes

Versions: 5

Compression:

Stored size: 645 Bytes

Contents

module SilenceDSLDeprecations
  class Reporter
    def initialize(reporter)
      @reporter = reporter
    end

    def deprecation(*)
      # do nothing
    end

    def respond_to?(*args)
      @reporter.respond_to?(*args) || super
    end

    def method_missing(*args, &block)
      @reporter.__send__(*args, &block)
    end
  end

  def silence_dsl_deprecations
    old_reporter = RSpec.configuration.reporter
    replace_reporter(Reporter.new(old_reporter))
    yield
  ensure
    replace_reporter(old_reporter)
  end

  def replace_reporter(new_reporter)
    RSpec.configuration.instance_variable_set(:@reporter, new_reporter)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rspec-core-2.99.2 spec/support/silence_dsl_deprecations.rb
rspec-core-2.99.1 spec/support/silence_dsl_deprecations.rb
rspec-core-2.99.0 spec/support/silence_dsl_deprecations.rb
rspec-core-2.99.0.rc1 spec/support/silence_dsl_deprecations.rb
rspec-core-2.99.0.beta2 spec/support/silence_dsl_deprecations.rb