Sha256: 4f0a0749b21db73970573a2047b7595986dd9c84047f22abb2dcf4b3c43e8d52

Contents?: true

Size: 1.11 KB

Versions: 7

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

RSpec.describe Airbrake::Rack::NoticeBuilder do
  describe "#build_notice" do
    it "doesn't overwrite session with nil" do
      notice_builder = described_class.new('rack.session' => nil)
      notice = notice_builder.build_notice(AirbrakeTestError.new)

      expect(notice[:session]).to eq({})
    end

    it "sets session if it is present" do
      session = { a: 1, b: 2 }
      notice_builder = described_class.new('rack.session' => session)
      notice = notice_builder.build_notice(AirbrakeTestError.new)

      expect(notice[:session]).to eq(session)
    end

    it "doesn't overwrite params with nil" do
      notice_builder = described_class.new('action_dispatch.request.parameters' => nil)
      notice = notice_builder.build_notice(AirbrakeTestError.new)

      expect(notice[:session]).to eq({})
    end

    it "sets params if they're present" do
      params = { a: 1, b: 2 }
      notice_builder = described_class.new('action_dispatch.request.parameters' => params)
      notice = notice_builder.build_notice(AirbrakeTestError.new)

      expect(notice[:params]).to eq(params)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
airbrake-5.0.5 spec/unit/rack/notice_builder_spec.rb
airbrake-5.0.4 spec/unit/rack/notice_builder_spec.rb
airbrake-5.0.3 spec/unit/rack/notice_builder_spec.rb
airbrake-5.0.2 spec/unit/rack/notice_builder_spec.rb
airbrake-5.0.1 spec/unit/rack/notice_builder_spec.rb
airbrake-5.0.0 spec/unit/rack/notice_builder_spec.rb
airbrake-5.0.0.rc.1 spec/unit/rack/notice_builder_spec.rb