Sha256: 86c6e6a2cb3d49495cb8356d70b39fa42d016fb556f84ef0b5ef40711cb95f7b
Contents?: true
Size: 1.55 KB
Versions: 19
Compression:
Stored size: 1.55 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
19 entries across 19 versions & 1 rubygems