Sha256: c1e2cd9bc12c65a715dd047c646b52d5fb9f15721414adea54e723ce2e2c2e74
Contents?: true
Size: 1.15 KB
Versions: 4
Compression:
Stored size: 1.15 KB
Contents
describe Appsignal::Hooks::MongoRubyDriverHook do require "appsignal/integrations/mongo_ruby_driver" context "with mongo ruby driver" do let(:subscriber) { Appsignal::Hooks::MongoMonitorSubscriber.new } before { allow(Appsignal::Hooks::MongoMonitorSubscriber).to receive(:new).and_return(subscriber) } before(:context) do module Mongo module Monitoring COMMAND = "command" class Global def subscribe end end end end end after(:context) { Object.send(:remove_const, :Mongo) } describe "#dependencies_present?" do subject { described_class.new.dependencies_present? } it { is_expected.to be_truthy } end it "adds a subscriber to Mongo::Monitoring" do expect(Mongo::Monitoring::Global).to receive(:subscribe) .with("command", subscriber) .at_least(:once) Appsignal::Hooks::MongoRubyDriverHook.new.install end end context "without mongo ruby driver" do describe "#dependencies_present?" do subject { described_class.new.dependencies_present? } it { is_expected.to be_falsy } end end end
Version data entries
4 entries across 4 versions & 1 rubygems