Sha256: cdb9e47a34d7acd0e2eec27f27d49949bd4120d7c6b81a4a21030036515efe2f

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

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 4, exc.bindings.first.eval('__LINE__')
    end

    test 'Exception#bindings returns all the bindings for a custom error' do
      exc = CustomErrorScenario.new.call

      assert_equal 6, exc.bindings.first.eval('__LINE__')
    end

    test 'Exception#bindings returns all the bindings for a bad custom error' do
      exc = BadCustomErrorScenario.new.call

      assert_equal 11, exc.bindings.first.eval('__LINE__')
    end

    test 'Exception#bindings goes down the stack' do
      exc = BasicNestedScenario.new.call

      assert_equal 12, exc.bindings.first.eval('__LINE__')
    end

    test 'Exception#bindings inside of an eval' do
      exc = EvalNestedScenario.new.call

      assert_equal 12, exc.bindings.first.eval('__LINE__')
    end

    test "re-raising doesn't lose Exception#bindings information" do
      exc = ReraisedScenario.new.call

      assert_equal 4, exc.bindings.first.eval('__LINE__')
    end

    test 'Exception#bindings is empty when exception is still not raised' do
      exc = RuntimeError.new

      assert_equal [], exc.bindings
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
web-console-2.1.3 test/web_console/integration_test.rb
web-console-2.1.2 test/web_console/integration_test.rb
web-console-2.1.1 test/web_console/integration_test.rb
web-console-2.1.0 test/web_console/integration_test.rb