Sha256: a10f0bcd8100f0f72d78a1d92c48acc00a84ee48f47346087252655cbbebf849
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
require "spec_helper" describe Timber::Events::Exception, :rails_23 => true do describe ".initialize" do it "should clean the backtrace" do backtrace = [ "/path/to/file1.rb:26:in `function1'", "path/to/file2.rb:86:in `function2'" ] exception_event = described_class.new(name: "RuntimeError", exception_message: "Boom", backtrace: backtrace) expect(exception_event.backtrace).to eq([{:file=>"/path/to/file1.rb", :line=>26, :function=>"function1"}, {:file=>"path/to/file2.rb", :line=>86, :function=>"function2"}]) end it "parses valid lines" do backtrace = [ "/path/to/file1.rb:26:in `function1'", "path/to/file2.rb:86" # function names are optional ] exception_event = described_class.new(name: "RuntimeError", exception_message: "Boom", backtrace: backtrace) expect(exception_event.backtrace).to eq([{:file=>"/path/to/file1.rb", :line=>26, :function=>"function1"}, {:file=>"path/to/file2.rb", :line=>86}]) end it "handles malformed lines" do backtrace = [ "malformed" ] exception_event = described_class.new(name: "RuntimeError", exception_message: "Boom", backtrace: backtrace) expect(exception_event.backtrace).to eq([{:file=>"malformed"}]) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
timber-2.1.1 | spec/timber/events/exception_spec.rb |