Sha256: 4c670b2bf75bee234022d9081b5e770f00e42aecb086f8f0709c48aaad9a3b7f

Contents?: true

Size: 948 Bytes

Versions: 1

Compression:

Stored size: 948 Bytes

Contents

require 'spec_helper'

describe Resque::Failure::GeneratesPagerdutyDesc do
  describe '.execute' do
    let(:payload) { {'class' => 'PayloadClass'} }

    context 'the complete description is 118 characters or more' do
      let(:exception) { ArgumentError.new('very long message'*8) }

      it 'should return a truncated description ending with an ellipsis' do
        message = described_class.execute(exception, payload)
        expect(message).to include('ArgumentError in PayloadClass: very long message')
        expect(message).to match(/\.{3}$/)
        expect(message.length).to eq(120)
      end
    end

    context 'the complete description is less than 118 characters' do
      let(:exception) { ArgumentError.new('My message') }

      it 'should return the complete description' do
        expect(described_class.execute(exception, payload)).
          to eq('ArgumentError in PayloadClass: My message')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
resque-pagerduty-0.1.1 spec/resque/failure/generates_pagerduty_desc_spec.rb