Sha256: 60fca04f9cb90e926a5ab587260c51bc2d988070c9028b379a37ef990b1e21f5
Contents?: true
Size: 1.61 KB
Versions: 19
Compression:
Stored size: 1.61 KB
Contents
describe Appsignal::Hooks::RedisHook do before do Appsignal.config = project_fixture_config Appsignal::Hooks.load_hooks end if DependencyHelper.redis_present? context "with redis" do context "with instrumentation enabled" do before do Appsignal.config.config_hash[:instrument_redis] = true allow_any_instance_of(Redis::Client).to receive(:process_without_appsignal).and_return(1) end 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 do Appsignal.config.config_hash[:instrument_redis] = false end describe "#dependencies_present?" do subject { described_class.new.dependencies_present? } it { is_expected.to be_falsy } end end end else context "without redis" do describe "#dependencies_present?" do subject { described_class.new.dependencies_present? } it { is_expected.to be_falsy } end end end end
Version data entries
19 entries across 19 versions & 1 rubygems