Sha256: dbb1ffd1715012b551ebbb57b938d00db805c3b0b7f2eb4ac5c3ae0c03b2d55d
Contents?: true
Size: 929 Bytes
Versions: 1
Compression:
Stored size: 929 Bytes
Contents
require 'spec_helper' describe Upsert do describe "logger" do it "logs where you tell it" do begin old_logger = Upsert.logger io = StringIO.new Thread.exclusive do Upsert.logger = Logger.new(io) Upsert.logger.warn "hello" io.rewind io.read.chomp.should == 'hello' end ensure Upsert.logger = old_logger end end it "logs queries" do require 'sqlite3' db = SQLite3::Database.open(':memory:') db.execute_batch "CREATE TABLE cats (name CHARACTER VARYING(255))" begin io = StringIO.new old_logger = Upsert.logger Upsert.logger = Logger.new io, Logger::DEBUG u = Upsert.new(db, :cats) u.row :name => 'you' io.rewind io.read.chomp.should =~ /INSERT OR IGNORE.*you/mi ensure Upsert.logger = old_logger end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
upsert-1.0.2 | spec/logger_spec.rb |