Sha256: 66143a3f310527e942821d4d8de2b9bc0100f5a45ba33802fd6bf8bf103c8bb9

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

require 'rubygems'
require 'logger'
unless Object.const_defined?('Sequel')
  $:.unshift(File.join(File.dirname(__FILE__), "../../lib/"))
  require 'sequel'
  Sequel.quote_identifiers = false
end
begin
  require File.join(File.dirname(File.dirname(__FILE__)), 'spec_config.rb')
rescue LoadError
end

class Spec::Example::ExampleGroup
  def log 
    begin
      INTEGRATION_DB.loggers << Logger.new(STDOUT)
      yield
    ensure
     INTEGRATION_DB.loggers.pop
    end 
  end 

  def self.log_specify(message, &block)
    specify(message){log{instance_eval(&block)}}
  end

  def self.cspecify(message, *checked, &block)
    pending = false
    checked.each do |c|
      case c
      when INTEGRATION_DB.class.adapter_scheme
        pending = c
      when Proc
        pending = c if c.first.call(INTEGRATION_DB)
      when Array
        pending = c if c.first == INTEGRATION_DB.class.adapter_scheme && c.last == INTEGRATION_DB.call(INTEGRATION_DB)
      end
    end
    if pending
      specify(message){pending("Not yet working on #{Array(pending).join(', ')}", &block)}
    else
      specify(message, &block)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sequel-3.10.0 spec/adapters/spec_helper.rb
sequel-3.9.0 spec/adapters/spec_helper.rb