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.12.0 spec/rollbar/truncation_spec.rb
rollbar-2.11.5 spec/rollbar/truncation_spec.rb
rollbar-2.11.4 spec/rollbar/truncation_spec.rb
rollbar-2.11.3 spec/rollbar/truncation_spec.rb
rollbar-2.11.2 spec/rollbar/truncation_spec.rb
rollbar-2.11.1 spec/rollbar/truncation_spec.rb
rollbar-2.11.0 spec/rollbar/truncation_spec.rb
rollbar-2.10.0 spec/rollbar/truncation_spec.rb
rollbar-2.9.1 spec/rollbar/truncation_spec.rb
rollbar-2.9.0 spec/rollbar/truncation_spec.rb
rollbar-2.8.3 spec/rollbar/truncation_spec.rb
rollbar-2.8.2 spec/rollbar/truncation_spec.rb
rollbar-2.8.1 spec/rollbar/truncation_spec.rb
rollbar-2.8.0 spec/rollbar/truncation_spec.rb
rollbar-2.7.1 spec/rollbar/truncation_spec.rb
rollbar-2.7.0 spec/rollbar/truncation_spec.rb
rollbar-2.6.3 spec/rollbar/truncation_spec.rb
rollbar-2.6.2 spec/rollbar/truncation_spec.rb
rollbar-2.6.1 spec/rollbar/truncation_spec.rb
rollbar-2.6.0 spec/rollbar/truncation_spec.rb