diff --git a/sentry-rails/spec/sentry/rails/tracing/active_support_subscriber_spec.rb b/sentry-rails/spec/sentry/rails/tracing/active_support_subscriber_spec.rb index 0c808203a..951ebb212 100644 --- a/sentry-rails/spec/sentry/rails/tracing/active_support_subscriber_spec.rb +++ b/sentry-rails/spec/sentry/rails/tracing/active_support_subscriber_spec.rb @@ -144,6 +144,22 @@ expect(cache_transaction[:spans][1][:data]['cache.key']).to eq(["my_cache_key_non_existing"]) expect(cache_transaction[:spans][1][:data]['cache.hit']).to eq(false) end + + it "tracks cache delete" do + Rails.cache.write("my_cache_key", "my_cache_value") + transaction = Sentry::Transaction.new(sampled: true, hub: Sentry.get_current_hub) + Sentry.get_current_scope.set_span(transaction) + Rails.cache.delete("my_cache_key") + + transaction.finish + expect(transport.events.count).to eq(1) + cache_transaction = transport.events.first.to_hash + expect(cache_transaction[:type]).to eq("transaction") + expect(cache_transaction[:spans].count).to eq(1) + expect(cache_transaction[:spans][0][:op]).to eq("cache.remove") + expect(cache_transaction[:spans][0][:origin]).to eq("auto.cache.rails") + expect(cache_transaction[:spans][0][:data]['cache.key']).to eq(["my_cache_key"]) + end end context "when transaction is not sampled" do