Sha256: 887ae9c50ed7ad06312610aa4e36e5afa0ce6c0bd2115f46626ae8fa7226a936

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

Sequel::Deprecation.backtrace_filter = lambda{|line, lineno| lineno < 4 || line =~ /_spec\.rb/}

class Minitest::HooksSpec
  def self.deprecated(a, &block)
    it("#{a} (deprecated)") do
      deprecated{instance_exec(&block)}
    end
  end

  def deprecated
    output = Sequel::Deprecation.output
    Sequel::Deprecation.output = nil
    yield
  ensure
    Sequel::Deprecation.output = output
  end

  def self.with_symbol_splitting(a, &block)
    it(a) do
      with_symbol_splitting{instance_exec(&block)}
    end
    it("#{a}, except when symbol_splitting disabled") do
      without_symbol_splitting{instance_exec(&block)}
    end
  end

  def without_symbol_splitting
    Sequel.split_symbols = false
    DB.send(:reset_default_dataset) if defined?(DB)
    proc{yield}.must_raise Minitest::Assertion
  ensure
    Sequel.split_symbols = :deprecated
    DB.send(:reset_default_dataset) if defined?(DB)
  end

  def with_symbol_splitting
    Sequel.split_symbols = true
    yield
  ensure
    Sequel.split_symbols = :deprecated
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
sequel-4.49.0 spec/deprecation_helper.rb
sequel-4.48.0 spec/deprecation_helper.rb
tdiary-5.0.5 vendor/bundle/gems/sequel-4.47.0/spec/deprecation_helper.rb
sequel-4.47.0 spec/deprecation_helper.rb
sequel-4.46.0 spec/deprecation_helper.rb