Sha256: 69c11c5a04e081e711536aaee31c8e97f4ba4ae18a585aee8d1365e2b00cf0ab
Contents?: true
Size: 1.33 KB
Versions: 4
Compression:
Stored size: 1.33 KB
Contents
require 'spec_helper' describe Upsert do MUTEX_FOR_PERFORM = Mutex.new describe "logger" do it "logs where you tell it" do begin old_logger = Upsert.logger io = StringIO.new MUTEX_FOR_PERFORM.synchronize 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 old_logger = Upsert.logger begin io = StringIO.new MUTEX_FOR_PERFORM.synchronize do Upsert.logger = Logger.new(io) u = Upsert.new($conn, :pets) u.row(:name => 'Jerry') io.rewind log = io.read.chomp case u.connection.class.name when /sqlite/i log.should =~ /insert or ignore/i when /mysql/i log.should =~ /call #{Upsert::MergeFunction::NAME_PREFIX}_pets_SEL_name/i when /p.*g/i # [54ae2eea857] Possibly much more useful debug output # TODO: Should check for both upsert and non-upsert log output log.should =~ /selector:|SHOW server_version/i else raise "not sure" end end ensure Upsert.logger = old_logger end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
upsert-2.9.10-java | spec/logger_spec.rb |
upsert-2.9.10 | spec/logger_spec.rb |
upsert-2.9.9-universal-java-11 | spec/logger_spec.rb |
upsert-2.9.9 | spec/logger_spec.rb |