diff --git a/test/web_console/middleware_test.rb b/test/web_console/middleware_test.rb index 5356931c..0d4a0bc0 100644 --- a/test/web_console/middleware_test.rb +++ b/test/web_console/middleware_test.rb @@ -28,11 +28,19 @@ def call(env) end test 'render console in an html application from web_console.exception' do - get '/', nil, 'CONTENT_TYPE' => 'text/html', 'web_console.binding' => raise_exception + get '/', nil, 'CONTENT_TYPE' => 'text/html', 'web_console.binding' => binding assert_select '#console' end + test 'prioritizes web_console.exception over web_console.binding' do + exception = raise_exception + + REPLSession.expects(:create).with(binding: exception.bindings.first, binding_stack: exception.bindings) + + get '/', nil, 'CONTENT_TYPE' => 'text/html', 'web_console.binding' => binding, 'web_console.exception' => exception + end + test 'render console in an html application with non text/html' do get '/', nil, 'CONTENT_TYPE' => 'application/xhtml+xml', 'web_console.binding' => binding