Sha256: 4c4b375ce974fecdc29be9267028875f95854bd482ffd884894639044306c271

Contents?: true

Size: 977 Bytes

Versions: 92

Compression:

Stored size: 977 Bytes

Contents

require 'spec_helper'

describe Appsignal::Hooks::MongoRubyDriverHook do
  require 'appsignal/integrations/mongo_ruby_driver'

  context "with mongo ruby driver" do
    let(:subscriber) { Appsignal::Hooks::MongoMonitorSubscriber.new }
    before { Appsignal::Hooks::MongoMonitorSubscriber.stub(:new => subscriber) }

    before(:all) do
      module Mongo
        module Monitoring
          COMMAND = 'command'

          class Global
            def subscribe
            end
          end
        end
      end
    end
    after(:all) { Object.send(:remove_const, :Mongo) }

    its(:dependencies_present?) { should be_true }

    it "adds a subscriber to Mongo::Monitoring" do
      Mongo::Monitoring::Global.should receive(:subscribe)
        .with('command', subscriber)
        .at_least(:once)

      Appsignal::Hooks::MongoRubyDriverHook.new.install
    end
  end

  context "without mongo ruby driver" do
    its(:dependencies_present?) { should be_false }
  end
end

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
appsignal-1.1.0.beta.10 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.0.6.beta.3 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.1.0.beta.9 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.0.6.beta.2 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.1.0.beta.8 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.0.6.beta.1 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.0.5 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.1.0.beta.7 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.0.5.beta.4 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.0.5.beta.3 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.0.5.beta.2 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.0.5.beta.1 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.0.4 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.1.0.beta.6 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.0.3 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.0.3.beta.2 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.0.3.beta.1 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.1.0.beta.5 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.1.0.beta.4 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
appsignal-1.1.0.beta.3 spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb