Sha256: 88f6cf2f9b096f3d62fb217b379186958d6510322c6bb605e7497e1263099902

Contents?: true

Size: 813 Bytes

Versions: 4

Compression:

Stored size: 813 Bytes

Contents

# -*- coding: utf-8 -*-
require 'spec_helper'

require 'ostruct'
require 'flail/backtrace'
require 'flail/exception'

describe Flail::Exception do
  
  #Setup flail with dummy handler as these tests aren't very complex.
  Flail.configure do
    handle do |payload|
      # Do nothing.
    end
  end

  subject { Flail::Exception.new(Exception.new, {}) }

  it "should not choke on bad utf-8" do
    b1r = 0xc0..0xc2
    b2r = 0x80..0xbf
    b1r.each do |b1|
      b2r.each do |b2|
        string = [b1,b2].pack("C*")

        lambda { subject.clean_unserializable_data({:test => string}).to_json }.should_not raise_error
      end
    end
  end

  it "should be able to accept a generic exception with no request attached" do
    lambda { Flail::Exception.notify(Exception.new) }.should_not raise_error
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flail-1.1.1 spec/exception_spec.rb
flail-1.1.0 spec/exception_spec.rb
flail-1.0.1 spec/exception_spec.rb
flail-1.0.0 spec/exception_spec.rb