Sha256: 0d0d366eda986a012c1bd049b08004e1151e7cb0cb434cbb824b4789616da794
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
describe Appsignal::Hooks::ActiveSupportNotificationsHook do if active_support_present? before :all do start_agent end before do Appsignal::Transaction.create("uuid", Appsignal::Transaction::HTTP_REQUEST, "test") end let(:notifier) { ActiveSupport::Notifications::Fanout.new } let(:instrumenter) { ActiveSupport::Notifications::Instrumenter.new(notifier) } its(:dependencies_present?) { should be_true } it "should instrument an AS notifications instrument call with a block" do expect(Appsignal::Transaction.current).to receive(:start_event) .at_least(:once) expect(Appsignal::Transaction.current).to receive(:finish_event) .at_least(:once) .with("sql.active_record", nil, "SQL", 1) return_value = instrumenter.instrument("sql.active_record", :sql => "SQL") do "value" end expect(return_value).to eq "value" end it "should not instrument events whose name starts with a bang" do expect(Appsignal::Transaction.current).not_to receive(:start_event) expect(Appsignal::Transaction.current).not_to receive(:finish_event) return_value = instrumenter.instrument("!sql.active_record", :sql => "SQL") do "value" end expect(return_value).to eq "value" end else its(:dependencies_present?) { should be_false } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
appsignal-2.1.0.beta.1 | spec/lib/appsignal/hooks/active_support_notifications_spec.rb |