Sha256: 1da581d7b361ed4872391a22955c4588c0e9ff03030ecb0e2366bb109c0dcb8d

Contents?: true

Size: 836 Bytes

Versions: 5

Compression:

Stored size: 836 Bytes

Contents

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

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

describe Flail::Exception do

  subject { Flail::Exception.new({}, Exception.new) }
  SAMPLE_BACKTRACE = [
                      "app/models/user.rb:13:in `magic'",
                      "app/controllers/users_controller.rb:8:in `index'"
                     ]

  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 and generic error with no request attached" do
    lambda { Flail::Exception.notify(Exception.new) }.should_not raise_error
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
flail-0.1.6 spec/exception_spec.rb
flail-0.1.5 spec/exception_spec.rb
flail-0.1.4 spec/exception_spec.rb
flail-0.1.3 spec/exception_spec.rb
flail-0.1.2 spec/exception_spec.rb