Sha256: 719d406e1194888618d1eb36f336de38907001169257e68be6c5d3ff5cb03b5a

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

gem 'minitest'
require 'minitest/autorun'
require 'minitest/hooks/default'
require 'minitest/shared_description'

require "#{File.dirname(__FILE__)}/deprecation_helper.rb"

def Sequel.guarded?(*checked)
  unless ENV['SEQUEL_NO_PENDING']
    checked.each do |c|
      case c
      when DB.database_type
        return c
      when Array
        case c.length
        when 1
          return c if c.first == DB.adapter_scheme
        when 2
          if c.first.is_a?(Proc)
            return c if c.last == DB.database_type && c.first.call(DB)
          elsif c.last.is_a?(Proc)
            return c if c.first == DB.adapter_scheme && c.last.call(DB)
          else
            return c if c.first == DB.adapter_scheme && c.last == DB.database_type
          end
        when 3
          return c if c[0] == DB.adapter_scheme && c[1] == DB.database_type && c[2].call(DB)
        end          
      end
    end
  end
  false
end

module Minitest::Spec::DSL
  def cspecify(message, *checked, &block)
    if pending = Sequel.guarded?(*checked)
      it(message) do
        skip "Not yet working on #{Array(pending).map{|x| x.is_a?(Proc) ? :proc : x}.join(', ')}"
      end
    else
      it(message, &block)
    end
  end
end

class Minitest::HooksSpec
  def log
    begin
      DB.loggers << Logger.new(STDOUT)
      yield
    ensure
     DB.loggers.pop
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

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