Sha256: 3220020d457b6e984aaec5ae4aa8e4dd29bed05018710a669c995e5a3ae75e70
Contents?: true
Size: 873 Bytes
Versions: 1
Compression:
Stored size: 873 Bytes
Contents
RSpec.describe ActiveRecord::SqlAnalyzer::BackgroundProcessor do include WaitForPop let(:instance) { described_class.new } let(:event) { { calls: [{ caller: "CALLER", sql: "SQL" }], logger: logger } } let(:logger) do Class.new do def self.events @events ||= [] end def self.filter_event(*) end def self.log(event) events << event sleep 2 end end end before do ActiveRecord::SqlAnalyzer.configure do |c| c.backtrace_filter_proc(Proc.new { |lines| "BFP #{lines}" }) c.complex_sql_redactor_proc(Proc.new { |sql| "CSRP #{sql}" }) end end it "processes in the background" do instance << event wait_for_pop expect(logger.events).to eq( [ calls: [{ caller: "BFP CALLER", sql: "CSRP SQL" }] ] ) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_record-sql_analyzer-0.3.0 | spec/active_record/sql_analyzer/background_processor_spec.rb |