Sha256: 2dcd0a817163d3a70063e873a8fcf1f6ea3d5fcaff1f5812b2da9f27495f0eea

Contents?: true

Size: 1.66 KB

Versions: 13

Compression:

Stored size: 1.66 KB

Contents

require 'spec_helper'
require 'rollbar/truncation/frames_strategy'

describe Rollbar::Truncation::MinBodyStrategy do
  describe '.call', :fixture => :payload do
    let(:message) { 'a' * 1_000 }

    context 'with trace key ' do
      let(:payload_fixture) { 'payloads/sample.trace.json' }
      let!(:frames) { payload['data']['body']['trace']['frames'].clone }

      before do
        payload['data']['body']['trace']['exception']['message'] = message
      end

      it 'truncates the exception message and frames array' do
        result = MultiJson.load(described_class.call(payload))

        trace = result['data']['body']['trace']
        expect(trace['frames']).to have(2).items
        expect(trace['exception']['message']).to be_eql('a' * 255)
      end
    end

    context 'with trace_chain key ' do
      let(:payload_fixture) { 'payloads/sample.trace_chain.json' }
      let!(:frames1) { payload['data']['body']['trace_chain'][0]['frames'].clone }
      let!(:frames2) { payload['data']['body']['trace_chain'][1]['frames'].clone }

      before do
        payload['data']['body']['trace_chain'][0]['exception']['message'] = message
        payload['data']['body']['trace_chain'][1]['exception']['message'] = message
      end

      it 'truncates the exception message and frames array' do
        result = MultiJson.load(described_class.call(payload))

        traces = result['data']['body']['trace_chain']
        expect(traces[0]['frames']).to have(2).items
        expect(traces[0]['exception']['message']).to be_eql('a' * 255)

        expect(traces[1]['frames']).to have(2).items
        expect(traces[1]['exception']['message']).to be_eql('a' * 255)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rollbar-1.5.1 spec/rollbar/truncation/min_body_strategy_spec.rb
rollbar-1.5.0 spec/rollbar/truncation/min_body_strategy_spec.rb
rollbar-1.4.5 spec/rollbar/truncation/min_body_strategy_spec.rb
rollbar-1.4.4 spec/rollbar/truncation/min_body_strategy_spec.rb
rollbar-1.4.3 spec/rollbar/truncation/min_body_strategy_spec.rb
rollbar-1.4.2 spec/rollbar/truncation/min_body_strategy_spec.rb
rollbar-1.4.1 spec/rollbar/truncation/min_body_strategy_spec.rb
rollbar-1.4.0 spec/rollbar/truncation/min_body_strategy_spec.rb
rollbar-1.3.2 spec/rollbar/truncation/min_body_strategy_spec.rb
rollbar-1.3.1 spec/rollbar/truncation/min_body_strategy_spec.rb
rollbar-1.3.0 spec/rollbar/truncation/min_body_strategy_spec.rb
rollbar-1.2.13 spec/rollbar/truncation/min_body_strategy_spec.rb
rollbar-1.2.12 spec/rollbar/truncation/min_body_strategy_spec.rb