Sha256: 8a9cdfc04bd4e5af43dccafae271b1661c18e4257e556c49d4e9cc08c0779d9e
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
require 'spec_helper' require 'appsignal/integrations/data_mapper' describe Appsignal::Hooks::DataMapperLogListener do module DataMapperLog def log(message) end end class DataMapperTestClass include DataMapperLog include Appsignal::Hooks::DataMapperLogListener def initialize(uri) @uri = uri end end describe "#log" do let!(:data_mapper_class) { DataMapperTestClass.new(uri) } let(:uri) { double(:scheme => 'mysql') } let(:transaction) { double } let(:message) do double( :query => "SELECT * from users", :duration => 100 ) end before do Appsignal::Transaction.stub(:current) { transaction } end 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(:uri) { double(:scheme => 'mongodb') } 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 { data_mapper_class.log(message) } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
appsignal-1.3.0.beta.3 | spec/lib/appsignal/integrations/data_mapper_spec.rb |