Sha256: 4f7887a3dc402bccb08caa8e3aebc0f04e4d17bd47fa32472ab0409bd18cc121
Contents?: true
Size: 945 Bytes
Versions: 1
Compression:
Stored size: 945 Bytes
Contents
require 'spec_helper' describe Upsert do describe "logger" do it "logs to stderr by default" do begin old_stderr = $stderr old_logger = Upsert.logger Upsert.logger = nil $stderr = StringIO.new Upsert.logger.warn "hello" $stderr.rewind $stderr.read.chomp.should == 'hello' ensure Upsert.logger = old_logger $stderr = old_stderr 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/i ensure Upsert.logger = old_logger end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
upsert-0.4.0 | spec/logger_spec.rb |