Sha256: f70aa8298821f2dcf4ec8414cd97db37f5adef76c8ef7f59b8392f9c6f448e32
Contents?: true
Size: 1.64 KB
Versions: 4
Compression:
Stored size: 1.64 KB
Contents
describe Appsignal::Hooks::RedisHook do before :context do start_agent end context "with redis" do before :context do class Redis class Client def process(_commands) 1 end end VERSION = "1.0" end end context "with instrumentation enabled" do before :context do Appsignal.config.config_hash[:instrument_redis] = true Appsignal::Hooks::RedisHook.new.install end after(:context) { Object.send(:remove_const, :Redis) } describe "#dependencies_present?" do subject { described_class.new.dependencies_present? } it { is_expected.to be_truthy } end it "should instrument a redis call" do Appsignal::Transaction.create("uuid", Appsignal::Transaction::HTTP_REQUEST, "test") expect(Appsignal::Transaction.current).to receive(:start_event) .at_least(:once) expect(Appsignal::Transaction.current).to receive(:finish_event) .at_least(:once) .with("query.redis", nil, nil, 0) client = Redis::Client.new expect(client.process([])).to eq 1 end end context "with instrumentation disabled" do before :context do Appsignal.config.config_hash[:instrument_net_http] = false end describe "#dependencies_present?" do subject { described_class.new.dependencies_present? } it { is_expected.to be_falsy } end end end context "without redis" 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