File: deprecation_helper.rb

package info (click to toggle)
ruby-sequel 5.63.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,408 kB
  • sloc: ruby: 113,747; makefile: 3
file content (30 lines) | stat: -rw-r--r-- 683 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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}, with symbol splitting enabled") do
      with_symbol_splitting{instance_exec(&block)}
    end
  end

  def with_symbol_splitting
    Sequel.split_symbols = true
    yield
  ensure
    Sequel.split_symbols = false
  end
end