Sha256: dd2c71d700c82505a608e5647f66f02cc66ea03f4909c8bf3890511524e3f9e7

Contents?: true

Size: 745 Bytes

Versions: 22

Compression:

Stored size: 745 Bytes

Contents

require 'spec_helper'

describe Errplane::BlackBox do
  before do
    begin
      1/0
    rescue Exception => e
      @exception = e
    end
  end

  describe ".new" do
    it "should create a new BlackBox" do
      black_box = Errplane::BlackBox.new
    end

    it "should accept an exception as a parameter" do

      black_box = Errplane::BlackBox.new(exception: @exception)
      black_box.should_not be_nil
    end
  end

  describe "#to_json" do
    it "should return a JSON string" do
      black_box = Errplane::BlackBox.new(exception: @exception)
      json = JSON.parse(black_box.to_json)

      json["message"].should == "divided by 0"
      json["time"].should_not be_nil
      json["backtrace"].should_not be_nil
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
errplane-0.2.7 spec/unit/black_box_spec.rb
errplane-0.2.6 spec/unit/black_box_spec.rb
errplane-0.2.5 spec/unit/black_box_spec.rb
errplane-0.2.4 spec/unit/black_box_spec.rb
errplane-0.2.3 spec/unit/black_box_spec.rb
errplane-0.2.0 spec/unit/black_box_spec.rb
errplane-0.1.9 spec/unit/black_box_spec.rb
errplane-0.1.8 spec/unit/black_box_spec.rb
errplane-0.1.7 spec/unit/black_box_spec.rb
errplane-0.1.6 spec/unit/black_box_spec.rb
errplane-0.1.5 spec/unit/black_box_spec.rb
errplane-0.1.4 spec/unit/black_box_spec.rb
errplane-0.1.3 spec/unit/black_box_spec.rb
errplane-0.1.2 spec/unit/black_box_spec.rb
errplane-0.1.1 spec/unit/black_box_spec.rb
errplane-0.1.0 spec/unit/black_box_spec.rb
errplane-0.0.6 spec/unit/black_box_spec.rb
errplane-0.0.5 spec/unit/black_box_spec.rb
errplane-0.0.4 spec/unit/black_box_spec.rb
errplane-0.0.3 spec/unit/black_box_spec.rb