Sha256: 7dc307068a5e528c4971dc827dc515d34b34116b58ead3ec4243aa16445ceeec
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
require 'rubygems' unless Object.const_defined?('Sequel') $:.unshift(File.join(File.dirname(File.expand_path(__FILE__)), "../../lib/")) require 'sequel/core' end if ENV['SEQUEL_COLUMNS_INTROSPECTION'] Sequel.extension :columns_introspection Sequel::Dataset.introspect_all_columns end class MockDataset < Sequel::Dataset def insert(*args) @db.execute insert_sql(*args) end def update(*args) @db.execute update_sql(*args) end def fetch_rows(sql) @db.execute(sql) yield({:id => 1, :x => 1}) end def quoted_identifier(c) "\"#{c}\"" end end class MockDatabase < Sequel::Database set_adapter_scheme :mock @@quote_identifiers = false self.identifier_input_method = nil self.identifier_output_method = nil attr_reader :sqls def execute(sql, opts={}) @sqls ||= [] @sqls << sql end def reset @sqls = [] end def transaction(opts={}); yield; end def dataset; MockDataset.new(self); end end class SchemaDummyDatabase < Sequel::Database attr_reader :sqls self.identifier_input_method = nil self.identifier_output_method = nil def execute(sql, opts={}) @sqls ||= [] @sqls << sql end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sequel-3.24.1 | spec/core/spec_helper.rb |
sequel-3.24.0 | spec/core/spec_helper.rb |
sequel-3.23.0 | spec/core/spec_helper.rb |