Sha256: 58cbc3ebed0bed7fa1953e7b83d44b3555eab60c659dd8b82caffd4aee8c5b4d

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

describe Raygun do
  let(:failsafe_logger) { FakeLogger.new }

  describe '#track_exception' do
    context 'send in background' do
      before do
        Raygun.setup do |c|
          c.silence_reporting = false
          c.send_in_background = true
          c.api_url = 'http://example.api'
          c.api_key = 'foo'
          c.debug = true
          c.failsafe_logger = failsafe_logger
        end
      end

      context 'request times out' do
        before do
          stub_request(:post, 'http://example.api/entries').to_timeout
        end

        it 'logs the failure to the failsafe logger' do
          error = StandardError.new

          Raygun.track_exception(error)

          # Occasionally doesn't write to the failsafe logger, add small timeout to add some safety
          sleep 0.1
          expect(failsafe_logger.get).to match /Problem reporting exception to Raygun/
        end
      end
    end
  end

  describe '#reset_configuration' do
    subject { Raygun.reset_configuration }
    it 'clears any customized configuration options' do
      Raygun.setup do |c|
        c.api_url = 'http://test.api'
      end

      expect { subject }.to change { Raygun.configuration.api_url }.from('http://test.api').to(Raygun.default_configuration.api_url)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
raygun4ruby-3.2.3 spec/raygun/raygun_spec.rb
raygun4ruby-3.2.3.pre spec/raygun/raygun_spec.rb
raygun4ruby-3.2.1 spec/raygun/raygun_spec.rb
raygun4ruby-3.2.0 spec/raygun/raygun_spec.rb
raygun4ruby-3.1.1 spec/raygun/raygun_spec.rb
raygun4ruby-3.1.0 spec/raygun/raygun_spec.rb