Sha256: adbc0dc005a0ad92a56302a963d1c34b68b91eb207ec6e40119ee72920559f94

Contents?: true

Size: 748 Bytes

Versions: 1

Compression:

Stored size: 748 Bytes

Contents

require "sequel"
require "sequel/string_nilifier"

class << Sequel::Model
  attr_writer :db_schema
  alias orig_columns columns
  def columns(*cols)
    return super if cols.empty?
    define_method(:columns){cols}
    @dataset.send(: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
if Sequel.respond_to? :cache_anonymous_models=
  Sequel.cache_anonymous_models = false
end

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 = MODEL_DB = db

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sequel-string_nilifier-1.3.0 spec/spec_helper.rb