Sha256: 32976c679acb969471b3592b445f32bc9e02009e1efe233ead951a3a43584a05

Contents?: true

Size: 836 Bytes

Versions: 2

Compression:

Stored size: 836 Bytes

Contents

require 'test_helper'
require 'web_console/extensions'

module ActionDispatch
  class DebugExceptionsTest < ActionDispatch::IntegrationTest
    class Application
      def call(env)
        ActionView::Base.new.render(inline: '<% @ivar = 42 %> <%= nil.raise %></h1')
      end
    end

    setup do
      Request.stubs(:whitelisted_ips).returns(IPAddr.new('0.0.0.0/0'))

      @app = DebugExceptions.new(Application.new)
    end

    test "follows ActionView::Template::Error original error in env['web_console.exception']" do
      get "/", {}, {
        'action_dispatch.show_detailed_exceptions' => true,
        'action_dispatch.show_exceptions' => true,
        'action_dispatch.logger' => Logger.new(StringIO.new)
      }

      assert_equal 42, request.env['web_console.exception'].bindings.first.eval('@ivar')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
web-console-2.1.3 test/web_console/extensions_test.rb
web-console-2.1.2 test/web_console/extensions_test.rb