Sha256: 9a33b7cd6592d5564f431476f8792e624f9b215ba88c145c706772b26651d3a5
Contents?: true
Size: 1.17 KB
Versions: 120
Compression:
Stored size: 1.17 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 do allow(Appsignal::Hooks::MongoMonitorSubscriber).to receive(:new).and_return(subscriber) end before(:context) do module Mongo module Monitoring COMMAND = "command".freeze 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
120 entries across 120 versions & 1 rubygems