Sha256: f54910f8298e6705067e3d295a0fdc568e342e6918fb8fd4d0a7861a38697e88

Contents?: true

Size: 1.74 KB

Versions: 9

Compression:

Stored size: 1.74 KB

Contents

require 'rubygems'
unless Object.const_defined?('Sequel') && Sequel.const_defined?('Model') 
  $:.unshift(File.join(File.dirname(File.expand_path(__FILE__)), "../../lib/"))
  require 'sequel'
end
Sequel::Deprecation.backtrace_filter = lambda{|line, lineno| lineno < 4 || line =~ /_spec\.rb/}

require File.join(File.dirname(File.expand_path(__FILE__)), "../rspec_helper.rb")

RSPEC_EXAMPLE_GROUP.class_eval do
  if ENV['SEQUEL_DEPRECATION_WARNINGS']
    class << self
      alias qspecify specify
    end
  else
    def self.qspecify(*a, &block)
      specify(*a) do
        begin
          output = Sequel::Deprecation.output
          Sequel::Deprecation.output = false
          instance_exec(&block)
        ensure
          Sequel::Deprecation.output = output 
        end
      end
    end
  end
end

Sequel.quote_identifiers = false
Sequel.identifier_input_method = nil
Sequel.identifier_output_method = nil

class << Sequel::Model
  attr_writer :db_schema
  alias orig_columns columns
  def columns(*cols)
    return super if cols.empty?
    define_method(:columns){cols}
    @dataset.instance_variable_set(:@columns, cols) if @dataset
    def_column_accessor(*cols)
    @columns = cols
    @db_schema = {}
    cols.each{|c| @db_schema[c] = {}}
  end
end

Sequel::Model.use_transactions = false
Sequel.cache_anonymous_models = false

db = Sequel.mock(:fetch=>{:id => 1, :x => 1}, :numrows=>1, :autoid=>proc{|sql| 10})
def db.schema(*) [[:id, {:primary_key=>true}]] end
def db.reset() sqls end
def db.supports_schema_parsing?() true end
Sequel::Model.db = DB = db

if ENV['SEQUEL_COLUMNS_INTROSPECTION']
  Sequel.extension :columns_introspection
  Sequel::Database.extension :columns_introspection
  Sequel::Mock::Dataset.send(:include, Sequel::ColumnsIntrospection)
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sequel-4.14.0 spec/model/spec_helper.rb
sequel-4.13.0 spec/model/spec_helper.rb
sequel-4.12.0 spec/model/spec_helper.rb
sequel-4.11.0 spec/model/spec_helper.rb
sequel-4.10.0 spec/model/spec_helper.rb
sequel-4.9.0 spec/model/spec_helper.rb
sequel-4.8.0 spec/model/spec_helper.rb
sequel-4.7.0 spec/model/spec_helper.rb
sequel-4.6.0 spec/model/spec_helper.rb