Sha256: 4cbca7b7fca4f629388440dd0d65b45eff061e3ee84b8a95089e64a0cc2e8d73
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
require "appsignal/integrations/data_mapper" describe Appsignal::Hooks::DataMapperLogListener do module DataMapperLog def log(message) end end describe "#log" do let(:transaction) { double } let(:message) do double( :query => "SELECT * from users", :duration => 100 ) end let(:connection_class) do module DataObjects module Sqlite3 class Connection include DataMapperLog include Appsignal::Hooks::DataMapperLogListener end end end end before { Appsignal::Transaction.stub(:current) { transaction } } it "should record the log entry in an event" do expect(transaction).to receive(:record_event).with( "query.data_mapper", "DataMapper Query", "SELECT * from users", 100, Appsignal::EventFormatter::SQL_BODY_FORMAT ) end context "when scheme is not sql-like" do let(:connection_class) do module DataObjects module MongoDB class Connection include DataMapperLog include Appsignal::Hooks::DataMapperLogListener end end end end it "should record the log entry in an event without body" do expect(transaction).to receive(:record_event).with( "query.data_mapper", "DataMapper Query", "", 100, Appsignal::EventFormatter::DEFAULT ) end end after { connection_class.new.log(message) } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
appsignal-2.1.0.beta.1 | spec/lib/appsignal/integrations/data_mapper_spec.rb |