1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
# frozen_string_literal: true
require "test_helper"
module WebConsole
class IntegrationTest < ActiveSupport::TestCase
test "Exception#bindings returns all the bindings of where the error originated" do
exc = FlatScenario.new.call
assert_equal 6, SourceLocation.new(exc.bindings.first).lineno
end
test "Exception#bindings returns all the bindings for a custom error" do
exc = CustomErrorScenario.new.call
assert_equal 8, SourceLocation.new(exc.bindings.first).lineno
end
test "Exception#bindings returns all the bindings for a bad custom error" do
exc = BadCustomErrorScenario.new.call
assert_equal 13, SourceLocation.new(exc.bindings.first).lineno
end
test "Exception#bindings goes down the stack" do
exc = BasicNestedScenario.new.call
assert_equal 14, SourceLocation.new(exc.bindings.first).lineno
end
test "Exception#bindings inside of an eval" do
exc = EvalNestedScenario.new.call
assert_equal 14, SourceLocation.new(exc.bindings.first).lineno
end
test "re-raising doesn't lose Exception#bindings information" do
exc = ReraisedScenario.new.call
assert_equal 6, SourceLocation.new(exc.bindings.first).lineno
end
test "Exception#bindings is empty when exception is still not raised" do
exc = RuntimeError.new
assert_equal [], exc.bindings
end
end
end
|