Sha256: 61f74d98e04ff3782316272b4a0eb1a126be729337643eb6f80f49b04a0fb1d7

Contents?: true

Size: 878 Bytes

Versions: 69

Compression:

Stored size: 878 Bytes

Contents

require 'spec_helper'
require 'rollbar/truncation'

describe Rollbar::Truncation do
  describe '.truncate' do
    let(:payload) { {} }

    context 'if truncation is not needed' do
      it 'only calls RawStrategy is truncation is not needed' do
        allow(described_class).to receive(:truncate?).and_return(false)
        expect(Rollbar::Truncation::RawStrategy).to receive(:call).with(payload)

        Rollbar::Truncation.truncate(payload)
      end
    end

    context 'if truncation is needed' do
      it 'calls the next strategy, FramesStrategy' do
        allow(described_class).to receive(:truncate?).and_return(true, false)
        expect(Rollbar::Truncation::RawStrategy).to receive(:call).with(payload)
        expect(Rollbar::Truncation::FramesStrategy).to receive(:call).with(payload)

        Rollbar::Truncation.truncate(payload)
      end
    end
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
rollbar-2.18.2 spec/rollbar/truncation_spec.rb
rollbar-2.18.0 spec/rollbar/truncation_spec.rb
rollbar-2.17.0 spec/rollbar/truncation_spec.rb
rollbar-2.16.4 spec/rollbar/truncation_spec.rb
rollbar-2.16.3 spec/rollbar/truncation_spec.rb
rollbar-2.16.2 spec/rollbar/truncation_spec.rb
rollbar-2.16.0 spec/rollbar/truncation_spec.rb
rollbar-2.15.6 spec/rollbar/truncation_spec.rb
rollbar-2.15.5 spec/rollbar/truncation_spec.rb
rollbar-2.15.4 spec/rollbar/truncation_spec.rb
rollbar-2.15.3 spec/rollbar/truncation_spec.rb
rollbar-2.15.2 spec/rollbar/truncation_spec.rb
rollbar-2.15.1 spec/rollbar/truncation_spec.rb
rollbar-2.15.0 spec/rollbar/truncation_spec.rb
rollbar-2.14.1 spec/rollbar/truncation_spec.rb
rollbar-2.14.0 spec/rollbar/truncation_spec.rb
rollbar-2.13.3 spec/rollbar/truncation_spec.rb
rollbar-2.13.2 spec/rollbar/truncation_spec.rb
rollbar-2.13.1 spec/rollbar/truncation_spec.rb
rollbar-2.13.0 spec/rollbar/truncation_spec.rb