Sha256: 11bab146bbfd5421a9ceb42c22a3fdb08062f3e9776cbe3322479ba4c9357048
Contents?: true
Size: 1.89 KB
Versions: 2
Compression:
Stored size: 1.89 KB
Contents
require 'spec_helper' require 'captivus/backtrace/line' describe Captivus::Backtrace::Line do def new_line(*args) Captivus::Backtrace::Line.new *args end describe ".new" do it "raises an argument error when the line is not a correctly formatted backtrace line" do [ nil, ' ', 'foo', '/Users/austin/something.rb:10:', "/Users/austin/something.rb:10:in 'something'", ].each do |line| expect { new_line line }.to raise_error(ArgumentError, /^Unrecognized format:/) end end it "does not raise an error when the line is a correctly formatted backtrace line" do [ "/Users/austin/dir/run-file.rb:1", "/Users/austin/go.rb:10:in `perform'", "C:/Users/austin/go.rb:10:in `perform'", "<internal:prelude>:10:in `synchronize'", ].each do |line| expect { new_line line }.to_not raise_error end end end describe "as_json" do context "when the line has the format <file>:<number>" do it "returns the parts, minus the method, in a hash" do new_line("/Users/austin/dir/run-file.rb:1").as_json.should == { 'file' => '/Users/austin/dir/run-file.rb', 'number' => 1 } end end context "when the line has the format <file>:<number>:in `<method>'" do it "returns the parts in a hash" do new_line("/Users/austin/go.rb:10:in `perform'").as_json.should == { 'file' => '/Users/austin/go.rb', 'number' => 10, 'method' => 'perform' } end end context "when the line has the format <drive>:<file>:<number>:in `<method>'" do it "returns the parts in a hash" do new_line("C:/Users/austin/go.rb:10:in `perform'").as_json.should == { 'file' => 'C:/Users/austin/go.rb', 'number' => 10, 'method' => 'perform' } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
captivus-0.0.6 | spec/captivus/backtrace/line_spec.rb |
captivus-0.0.5 | spec/captivus/backtrace/line_spec.rb |