Sha256: 9a325a76a53564ae8dec5577cb1668635d8a882d2f7aad03790472c9fc578fe0
Contents?: true
Size: 1.49 KB
Versions: 11
Compression:
Stored size: 1.49 KB
Contents
require 'spec_helper' describe Bugsnag::Middleware::Rails3Request do before(:each) do Bugsnag.configuration.middleware.use(described_class) end describe "#call" do it "sets request metadata" do Bugsnag.configuration.set_request_data(:rack_env, { "action_dispatch.remote_ip" => "10.2.2.224", "action_dispatch.request_id" => "5", }) Bugsnag.notify(BugsnagTestException.new('Grimbles')) expect(Bugsnag).to have_sent_notification { |payload| event = get_event_from_payload(payload) puts event["metaData"].inspect expect(event["metaData"]["request"]).to eq({ "clientIp" => "10.2.2.224", "requestId" => "5" }) } end context "the Remote IP will throw when serialized" do it "sets the client IP metdata to [SPOOF]" do class SpecialIP def to_s raise BugsnagTestException.new('oh no') end end Bugsnag.configuration.set_request_data(:rack_env, { "action_dispatch.remote_ip" => SpecialIP.new, "action_dispatch.request_id" => "5", }) Bugsnag.notify(BugsnagTestException.new('Grimbles')) expect(Bugsnag).to have_sent_notification { |payload| event = get_event_from_payload(payload) puts event["metaData"].inspect expect(event["metaData"]["request"]).to eq({ "clientIp" => "[SPOOF]", "requestId" => "5" }) } end end end end
Version data entries
11 entries across 11 versions & 1 rubygems