examples/rr/errors/rr_error_example.rb in rr-0.1.3 vs examples/rr/errors/rr_error_example.rb in rr-0.1.4
- old
+ new
@@ -40,8 +40,27 @@
end
backtrace = error.backtrace.join("\n")
backtrace.should include("lib/rr")
end
+
+ it "returns custom backtrace when backtrace is set" do
+ error = RRError.new
+ custom_backtrace = caller
+ error.backtrace = custom_backtrace
+ error.backtrace.should == custom_backtrace
+ end
+
+ it "returns normal backtrace when backtrace is not set" do
+ error = nil
+ expected_line = __LINE__ + 2
+ begin
+ raise RRError
+ rescue RRError => e
+ error = e
+ end
+ error.backtrace.first.should include(__FILE__)
+ error.backtrace.first.should include(expected_line.to_s)
+ end
end
end
end
\ No newline at end of file